def pitch_to_midi_pitch(step, alter, octave):
  """Convert MusicXML pitch representation to MIDI pitch number."""
  pitch_class = 0
  if step == 'C':
    pitch_class = 0
  elif step == 'D':
    pitch_class = 2
  elif step == 'E':
    pitch_class = 4
  elif step == 'F':
    pitch_class = 5
  elif step == 'G':
    pitch_class = 7
  elif step == 'A':
    pitch_class = 9
  elif step == 'B':
    pitch_class = 11
  else:
    pass
  pitch_class = (pitch_class + int(alter))
  midi_pitch = (12 + pitch_class) + (int(octave) * 12)
  return midi_pitch