pyabc2.PitchClass¶
- class pyabc2.PitchClass(value)¶
Pitch without octave. Value as integer chromatic distance from C in semitones (half steps).
- Parameters:
value (int) – Chromatic distance from C in semitones (half steps). For example, C is 0, D is 2, B is 11.
Examples
>>> from pyabc2 import PitchClass >>> PitchClass(0) PitchClass(value=0, name='C') >>> PitchClass(2) PitchClass(value=2, name='D') >>> PitchClass(11) PitchClass(value=11, name='B')
>>> PitchClass.from_name('Bb') PitchClass(value=10, name='Bb')
>>> PitchClass.from_name('E#') PitchClass(value=5, name='E#') >>> PitchClass(5) PitchClass(value=5, name='F')
Methods
__init__(value)from_name(name)From pitch class name (e.g.,
C,F#).from_pitch(p)From pitch instance.
scale_degree_in(key, *[, num_fmt, acc_fmt])String representation of scale degree allowing #/b.
scale_degree_int_in(key)Integer scale degree in key.
solfege_in(key)Solfège symbol in the context of a given key.
to_pitch(octave)Convert to pitch in the specified octave.
unicode()String repr using unicode accidental symbols.
value_in(key, *[, mod])Chromatic value in key.
Attributes
accAccidentals in the note name.
dvalue_accRelative chromatic value of the accidentals.
equivalent_flatequivalent_naturalequivalent_sharpisflatisnatissharpnameThe note (pitch class) name (ASCII).
natNatural note name (without accidentals).
value_natChromatic value ignoring accidentals.
valuePitch class value (integer chromatic distance from C in semitones (half steps)).