pitchclass
- pitchtools.pitchclass(notename, semitone_divisions=1)[source]
Returns the pitchclass of a given note, rounded to the nearest semitone division
This index is independent of the pitche’s octave. For chromatic resolotion (semitone_divisions=1), 4C has a pitchclass of 0 (the same as any other C), 4C# and 4Db have a pitchclass of 1, 4D a pitchclass of 2, etc. If semitone_divisions is 2, then 4C has still a pitchclass of ß but 4C# would have a pitchclass of 2, while 4C+ and 4Db- would result in a pitchclass of 1. Enharmonic pitches (4C# and 4Db) result in the same pitchclass.
- Parameters:
notename (
str
) – the pitch as notenamesemitone_divisions – the number of divisions per semitone (1=chromatic, 2=quarter tones, …)
- Return type:
int
- Returns:
the pitch-class index.