Class: Pitch

music21.pitch. Pitch

new Pitch(pn)

Pitch objects are found in music21.note.Note objects, and many other places.

They do not have a music21.duration.Duration associated with them, so they
cannot be placed inside objects.

Valid pitch name formats are

  • "C", "D', etc. ("B" = American B; "H" is not allowed)
  • "C#", "C-" (C-flat; do not use "b" for flat), "C##", "C###", "C--" etc.
  • Octave may be specified after the name + accidental: "C#4" etc.
  • Octave can be arbitrarily high ("C10") but only as low as "C0" because "C-1" would be interpreted as C-flat octave 1; shift octave later for very low notes.
  • If octave is not specified, the system will usually use octave 4, but might adjust according to context. If you do not like this behavior, give an octave always.
  • Microtones are not supported in music21j (they are in music21p)
Name Type Description
pn string

name of the pitch, with or without octave, see above.

Name Type Description
accidental music21.pitch.Accidental | undefined

link to an accidental

diatonicNoteNum number

diatonic number of the pitch, where 29 = C4, C#4, C-4, etc.; 30 = D-4, D4, D#4, etc. updates other properties.

midi number

midi number of the pitch (C4 = 60); readonly. See music21.pitch.Pitch#ps for setable version.

name string

letter name of pitch + accidental modifier; e.g., B-flat = 'B-'; changes automatically w/ step and accidental

nameWithOctave string

letter name of pitch + accidental modifier + octave; changes automatically w/ step, accidental, and octave

octave number

number for the octave, where middle C = C4, and octaves change between B and C; default 4

ps number

pitch space number, like midi number but floating point and w/ no restriction on range. C4 = 60.0

step string

letter name for the pitch (C-G, A, B), without accidental; default 'C'



Music21j, Copyright © 2013-2018 Michael Scott Cuthbert and cuthbertLab.
Documentation generated by JSDoc 3.5.5 on Wed Jul 4th 2018 using the DocStrap template.