Added a convertPitch function to convert noteName to pitch.