abjad.pitch
|
Changes |
|
Accidental. |
|
Abstract interval. |
|
Abstract interval-class. |
|
Named interval. |
|
Named interval-class. |
Named inversion-equivalent interval-class. |
|
|
Named pitch. |
|
Named pitch-class. |
|
Numbered interval. |
|
Numbered interval-class. |
Numbered inversion-equivalent interval-class. |
|
|
Numbered pitch. |
|
Numbered pitch-class. |
|
Octave. |
|
Abstract pitch. |
|
Abstract pitch-class. |
|
Staff position. |
- abjad.pitch.pitches(items: Sequence[float | str]) list[NamedPitch] [source]
Changes
items
to pitches.
- class abjad.pitch.Accidental(name: str = 'natural', arrow: bool = False)[source]
Accidental.
>>> abjad.Accidental("ff") Accidental(name='double flat')
>>> abjad.Accidental("tqf") Accidental(name='three-quarters flat')
>>> abjad.Accidental("f") Accidental(name='flat')
>>> abjad.Accidental("") Accidental(name='natural')
>>> abjad.Accidental("qs") Accidental(name='quarter sharp')
>>> abjad.Accidental("s") Accidental(name='sharp')
>>> abjad.Accidental("tqs") Accidental(name='three-quarters sharp')
>>> abjad.Accidental("ss") Accidental(name='double sharp')
Generalized accidentals are allowed:
>>> abjad.Accidental("ssss") Accidental(name='ssss')
Less than is true when
argument
is an accidental with semitones greater than those of this accidental:>>> accidental_1 = abjad.Accidental("f") >>> accidental_2 = abjad.Accidental("f") >>> accidental_3 = abjad.Accidental("s")
>>> accidental_1 < accidental_1 False
>>> accidental_1 < accidental_2 False
>>> accidental_1 < accidental_3 True
>>> accidental_2 < accidental_1 False
>>> accidental_2 < accidental_2 False
>>> accidental_2 < accidental_3 True
>>> accidental_3 < accidental_1 False
>>> accidental_3 < accidental_2 False
>>> accidental_3 < accidental_3 False
>>> abjad.Accidental("ff").semitones -2
>>> abjad.Accidental("tqf").semitones -1.5
>>> abjad.Accidental("f").semitones -1
>>> abjad.Accidental("").semitones 0
>>> abjad.Accidental("qs").semitones 0.5
>>> abjad.Accidental("s").semitones 1
>>> abjad.Accidental("tqs").semitones 1.5
>>> abjad.Accidental("ss").semitones 2
>>> abjad.Accidental("ff").name 'double flat'
>>> abjad.Accidental("tqf").name 'three-quarters flat'
>>> abjad.Accidental("f").name 'flat'
>>> abjad.Accidental("").name 'natural'
>>> abjad.Accidental("qs").name 'quarter sharp'
>>> abjad.Accidental("s").name 'sharp'
>>> abjad.Accidental("tqs").name 'three-quarters sharp'
>>> abjad.Accidental("ss").name 'double sharp'
symbol
()Gets symbol of accidental.
- symbol() str [source]
Gets symbol of accidental.
>>> abjad.Accidental("ff").symbol() 'bb'
>>> abjad.Accidental("tqf").symbol() 'tqf'
>>> abjad.Accidental("f").symbol() 'b'
>>> abjad.Accidental("").symbol() ''
>>> abjad.Accidental("qs").symbol() 'qs'
>>> abjad.Accidental("s").symbol() '#'
>>> abjad.Accidental("tqs").symbol() 'tqs'
>>> abjad.Accidental("ss").symbol() '##'
- class abjad.pitch.Interval(argument)[source]
Abstract interval.
cents
()Gets cents of interval.
Gets direction number of interval
Gets interval-class of interval.
number
()Gets number of interval.
octaves
()Gets octaves of interval.
Gets semitones of interval.
transpose
(pitch_carrier)Transposes
pitch_carrier
by interval.
- class abjad.pitch.IntervalClass(argument)[source]
Abstract interval-class.
number
()Gets number of interval-class.
transpose
(pitch_carrier)Transposes
pitch_carrier
by interval-class.
- class abjad.pitch.NamedInterval(name='P1')[source]
Named interval.
Initializes ascending major ninth from string:
>>> abjad.NamedInterval("+M9") NamedInterval('+M9')
Initializes descending major third from number of semitones:
>>> abjad.NamedInterval(-4) NamedInterval('-M3')
Initializes from other named interval:
>>> abjad.NamedInterval(abjad.NamedInterval(-4)) NamedInterval('-M3')
Initializes from numbered interval:
>>> abjad.NamedInterval(abjad.NumberedInterval(3)) NamedInterval('+m3')
Initializes from pair of quality and diatonic number:
>>> abjad.NamedInterval(("M", 3)) NamedInterval('+M3')
Gets direction number of named interval.
Gets named interval class.
name
()Gets name of named interval.
number
()Gets number of named interval.
octaves
()Gets octaves of interval.
quality
()Gets quality of named interval.
Gets semitones of named interval.
Gets staff spaces of named interval.
transpose
(pitch_carrier)Transposes
pitch_carrier
by named interval.- overridden direction_number() int [source]
Gets direction number of named interval.
>>> abjad.NamedInterval("+M9").direction_number() 1
>>> abjad.NamedInterval("+dim2").direction_number() 1
>>> abjad.NamedInterval("+A1").direction_number() 1
>>> abjad.NamedInterval("P1").direction_number() 0
>>> abjad.NamedInterval("-m3").direction_number() -1
- overridden interval_class() NamedIntervalClass [source]
Gets named interval class.
>>> abjad.NamedInterval("+M9").interval_class() NamedIntervalClass('+M2')
>>> abjad.NamedInterval("-M9").interval_class() NamedIntervalClass('-M2')
>>> abjad.NamedInterval("P1").interval_class() NamedIntervalClass('P1')
>>> abjad.NamedInterval("+P8").interval_class() NamedIntervalClass('+P8')
- overridden number() int | float [source]
Gets number of named interval.
>>> abjad.NamedInterval("+M9").number() 9
- overridden semitones() int [source]
Gets semitones of named interval.
>>> abjad.NamedInterval("+M9").semitones() 14
>>> abjad.NamedInterval("-M9").semitones() -14
>>> abjad.NamedInterval("P1").semitones() 0
>>> abjad.NamedInterval("+P8").semitones() 12
>>> abjad.NamedInterval("-P8").semitones() -12
- staff_spaces() float | int [source]
Gets staff spaces of named interval.
>>> abjad.NamedInterval("+M9").staff_spaces() 8
>>> abjad.NamedInterval("-M9").staff_spaces() -8
>>> abjad.NamedInterval("P1").staff_spaces() 0
>>> abjad.NamedInterval("+P8").staff_spaces() 7
>>> abjad.NamedInterval("-P8").staff_spaces() -7
- class abjad.pitch.NamedIntervalClass(name='P1')[source]
Named interval-class.
>>> abjad.NamedIntervalClass("-M9") NamedIntervalClass('-M2')
Gets direction number of named interval-class.
name
()Gets name of named interval-class.
quality
()Gets quality of named interval-class.
- direction_number() int [source]
Gets direction number of named interval-class.
>>> abjad.NamedIntervalClass("P1").direction_number() 0
>>> abjad.NamedIntervalClass("+M2").direction_number() 1
>>> abjad.NamedIntervalClass("-M2").direction_number() -1
- class abjad.pitch.NamedInversionEquivalentIntervalClass(name='P1')[source]
Named inversion-equivalent interval-class.
Initializes from string:
>>> abjad.NamedInversionEquivalentIntervalClass("-m14") NamedInversionEquivalentIntervalClass('+M2')
Initializes from pair:
>>> abjad.NamedInversionEquivalentIntervalClass(("perfect", 1)) NamedInversionEquivalentIntervalClass('P1')
>>> abjad.NamedInversionEquivalentIntervalClass(("perfect", -1)) NamedInversionEquivalentIntervalClass('P1')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", 4)) NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", -4)) NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", 11)) NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", -11)) NamedInversionEquivalentIntervalClass('+A4')
Initializes from other interval-class:
>>> interval_class = abjad.NamedInversionEquivalentIntervalClass("P1") >>> abjad.NamedInversionEquivalentIntervalClass(interval_class) NamedInversionEquivalentIntervalClass('P1')
- class abjad.pitch.NamedPitch(name="c'", *, accidental=None, arrow=None, octave=None)[source]
Named pitch.
Initializes from pitch name:
>>> abjad.NamedPitch("cs''") NamedPitch("cs''")
Initializes quartertone from pitch name:
>>> abjad.NamedPitch("aqs") NamedPitch('aqs')
Initializes from pitch-class / octave string:
>>> abjad.NamedPitch("C#5") NamedPitch("cs''")
Initializes quartertone from pitch-class / octave string:
>>> abjad.NamedPitch("A+3") NamedPitch('aqs')
>>> abjad.NamedPitch("Aqs3") NamedPitch('aqs')
Initializes arrowed pitch:
>>> abjad.NamedPitch("C#5", arrow=abjad.UP) NamedPitch("cs''", arrow=Vertical.UP)
REGRESSION. Small floats just less than a C initialize in the correct octave:
Initializes c / C3:
>>> abjad.NamedPitch(-12.1) NamedPitch('c')
Initializes c’ / C4:
>>> abjad.NamedPitch(-0.1) NamedPitch("c'")
Initializes c’’ / C5:
>>> abjad.NamedPitch(11.9) NamedPitch("c''")
Gets accidental of named pitch.
arrow
()Gets arrow of named pitch.
get_name_in_locale
([locale])Gets name of named pitch according to
locale
.hertz
()Gets frequency of named pitch in Hertz.
invert
([axis])Inverts named pitch around
axis
.multiply
([n])Multiplies named pitch.
name
()Gets name of named pitch.
number
()Gets number of named pitch.
octave
()Gets octave of named pitch.
Gets pitch-class of named pitch.
respell
([accidental])Respells named pitch with
accidental
.simplify
()Reduce alteration to between -2 and 2 while maintaining identical pitch number.
transpose
([n])Transposes named pitch by index
n
.- accidental() Accidental [source]
Gets accidental of named pitch.
>>> abjad.NamedPitch("c''").accidental() Accidental(name='natural')
>>> abjad.NamedPitch("cs''").accidental() Accidental(name='sharp')
>>> abjad.NamedPitch("df''").accidental() Accidental(name='flat')
- overridden arrow()[source]
Gets arrow of named pitch.
Returns up, down or none.
>>> abjad.NamedPitch("cs''").arrow() is None True
>>> abjad.NamedPitch("cs''", arrow=abjad.UP).arrow() <Vertical.UP: 1>
>>> abjad.NamedPitch("cs''", arrow=abjad.DOWN).arrow() <Vertical.DOWN: -1>
Displays arrow in interpreter representation:
>>> abjad.NamedPitch("cs''", arrow=abjad.DOWN) NamedPitch("cs''", arrow=Vertical.DOWN)
- overridden get_name_in_locale(locale=None) str [source]
Gets name of named pitch according to
locale
.Set
locale
to'us'
or none.>>> abjad.NamedPitch("cs''").get_name_in_locale() "cs''"
>>> abjad.NamedPitch("cs''").get_name_in_locale(locale="us") 'C#5'
- overridden hertz() float [source]
Gets frequency of named pitch in Hertz.
>>> abjad.NamedPitch("c''").hertz() 523.2511306011972
>>> abjad.NamedPitch("cs''").hertz() 554.3652619537442
>>> abjad.NamedPitch("df''").hertz() 554.3652619537442
- overridden invert(axis=None) NamedPitch [source]
Inverts named pitch around
axis
.Interprets none-valued
axis
equal to middle C.Inverts pitch around middle C explicitly:
>>> abjad.NamedPitch("d'").invert("c'") NamedPitch('bf')
>>> abjad.NamedPitch("bf").invert("c'") NamedPitch("d'")
Inverts pitch around middle C implicitly:
>>> abjad.NamedPitch("d'").invert() NamedPitch('bf')
>>> abjad.NamedPitch("bf").invert() NamedPitch("d'")
Inverts pitch around A3:
>>> abjad.NamedPitch("d'").invert("a") NamedPitch('e')
- overridden multiply(n=1) NamedPitch [source]
Multiplies named pitch.
>>> abjad.NamedPitch("d'").multiply(1) NamedPitch("d'")
>>> abjad.NamedPitch("d'").multiply(3) NamedPitch("fs'")
>>> abjad.NamedPitch("d'").multiply(6) NamedPitch("c''")
>>> abjad.NamedPitch("d'").multiply(6.5) NamedPitch("cs''")
- overridden name() str [source]
Gets name of named pitch.
>>> abjad.NamedPitch("c''").name() "c''"
>>> abjad.NamedPitch("cs''").name() "cs''"
>>> abjad.NamedPitch("df''").name() "df''"
- overridden number() int | float [source]
Gets number of named pitch.
>>> abjad.NamedPitch("c''").number() 12
>>> abjad.NamedPitch("cs''").number() 13
>>> abjad.NamedPitch("df''").number() 13
>>> abjad.NamedPitch("cf'").number() -1
- overridden octave() Octave [source]
Gets octave of named pitch.
>>> abjad.NamedPitch("c''").octave() Octave(number=5)
>>> abjad.NamedPitch("cs''").octave() Octave(number=5)
>>> abjad.NamedPitch("df''").octave() Octave(number=5)
- overridden pitch_class() NamedPitchClass [source]
Gets pitch-class of named pitch.
>>> abjad.NamedPitch("c''").pitch_class() NamedPitchClass('c')
>>> abjad.NamedPitch("cs''").pitch_class() NamedPitchClass('cs')
>>> abjad.NamedPitch("df''").pitch_class() NamedPitchClass('df')
- respell(accidental='sharps')[source]
Respells named pitch with
accidental
.>>> abjad.NamedPitch("cs").respell(accidental="flats") NamedPitch('df')
>>> abjad.NamedPitch("df").respell(accidental="sharps") NamedPitch('cs')
- simplify() NamedPitch [source]
Reduce alteration to between -2 and 2 while maintaining identical pitch number.
Note
LilyPond by default only supports accidentals from double-flat to double-sharp.
>>> abjad.NamedPitch("cssqs'").simplify() NamedPitch("dqs'")
>>> abjad.NamedPitch("cfffqf'").simplify() NamedPitch('aqf')
>>> float(abjad.NamedPitch("cfffqf'").simplify()) == float(abjad.NamedPitch("aqf")) True
- overridden transpose(n=0) NamedPitch [source]
Transposes named pitch by index
n
.Transposes C4 up a minor second:
>>> abjad.NamedPitch("c'").transpose(n="m2") NamedPitch("df'")
Transposes C4 down a major second:
>>> abjad.NamedPitch("c'").transpose(n="-M2") NamedPitch('bf')
- class abjad.pitch.NamedPitchClass(name='c', *, accidental=None, arrow=None)[source]
Named pitch-class.
Initializes from pitch-class name:
>>> abjad.NamedPitchClass("cs") NamedPitchClass('cs')
>>> abjad.NamedPitchClass("cqs") NamedPitchClass('cqs')
Initializes from number of semitones:
>>> abjad.NamedPitchClass(14) NamedPitchClass('d')
>>> abjad.NamedPitchClass(14.5) NamedPitchClass('dqs')
Initializes from named pitch:
>>> abjad.NamedPitchClass(abjad.NamedPitch("d")) NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.NamedPitch("dqs")) NamedPitchClass('dqs')
Initializes from numbered pitch:
>>> abjad.NamedPitchClass(abjad.NumberedPitch(14)) NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.NumberedPitch(14.5)) NamedPitchClass('dqs')
Initializes from numbered pitch-class:
>>> abjad.NamedPitchClass(abjad.NumberedPitchClass(2)) NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.NumberedPitchClass(2.5)) NamedPitchClass('dqs')
Initializes from pitch-class / octave-number string:
>>> abjad.NamedPitchClass("C#5") NamedPitchClass('cs')
>>> abjad.NamedPitchClass("Cs5") NamedPitchClass('cs')
Initializes quartertone from pitch-class / octave-number string:
>>> abjad.NamedPitchClass("C+5") NamedPitchClass('cqs')
>>> abjad.NamedPitchClass("Cqs5") NamedPitchClass('cqs')
Initializes from pitch-class string:
>>> abjad.NamedPitchClass("C#") NamedPitchClass('cs')
>>> abjad.NamedPitchClass("Cs") NamedPitchClass('cs')
>>> abjad.NamedPitchClass("cs") NamedPitchClass('cs')
Initializes quartertone from pitch-class string
>>> abjad.NamedPitchClass("C+") NamedPitchClass('cqs')
>>> abjad.NamedPitchClass("Cqs") NamedPitchClass('cqs')
>>> abjad.NamedPitchClass("cqs") NamedPitchClass('cqs')
Initializes from note:
>>> abjad.NamedPitchClass(abjad.Note("d''8.")) NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.Note("dqs''8.")) NamedPitchClass('dqs')
Gets accidental.
arrow
()Gets arrow of named pitch-class.
invert
([axis])Inverts named pitch-class.
multiply
([n])Multiplies named pitch-class by
n
.name
()Gets name of named pitch-class.
number
()Gets number.
Gets pitch-class label.
transpose
([n])Transposes named pitch-class by index named interval
n
.- overridden accidental() Accidental [source]
Gets accidental.
>>> abjad.NamedPitchClass("cs").accidental() Accidental(name='sharp')
- overridden invert(axis=None) NamedPitchClass [source]
Inverts named pitch-class.
- overridden multiply(n=1) NamedPitchClass [source]
Multiplies named pitch-class by
n
.>>> abjad.NamedPitchClass("cs").multiply(3) NamedPitchClass('ef')
- overridden pitch_class_label() str [source]
Gets pitch-class label.
>>> abjad.NamedPitchClass("cs").pitch_class_label() 'C#'
- overridden transpose(n=0) NamedPitchClass [source]
Transposes named pitch-class by index named interval
n
.>>> interval = abjad.NamedInterval("-M2") >>> abjad.NamedPitchClass("cs").transpose(interval) NamedPitchClass('b')
>>> interval = abjad.NamedInterval("P1") >>> abjad.NamedPitchClass("cs").transpose(interval) NamedPitchClass('cs')
>>> interval = abjad.NamedInterval("+M2") >>> abjad.NamedPitchClass("cs").transpose(interval) NamedPitchClass('ds')
- class abjad.pitch.NumberedInterval(number=0)[source]
Numbered interval.
Initializes from number of semitones:
>>> abjad.NumberedInterval(-14) NumberedInterval(-14)
Initializes from other numbered interval:
>>> abjad.NumberedInterval(abjad.NumberedInterval(-14)) NumberedInterval(-14)
Initializes from named interval:
>>> abjad.NumberedInterval(abjad.NamedInterval("-P4")) NumberedInterval(-5)
Initializes from interval string:
>>> abjad.NumberedInterval("-P4") NumberedInterval(-5)
Gets direction number of numbered interval.
Gets numbered interval class.
number
()Gets number of numbered interval.
octaves
()Gets octaves of interval.
Gets semitones corresponding to numbered interval.
Gets signed string.
transpose
(pitch_carrier)Transposes
pitch_carrier
- overridden direction_number() int [source]
Gets direction number of numbered interval.
>>> abjad.NumberedInterval(-14).direction_number() -1
>>> abjad.NumberedInterval(0).direction_number() 0
>>> abjad.NumberedInterval(6).direction_number() 1
- overridden interval_class() NumberedIntervalClass [source]
Gets numbered interval class.
- overridden number() float | int [source]
Gets number of numbered interval.
>>> abjad.NumberedInterval(-14).number() -14
>>> abjad.NumberedInterval(-2).number() -2
>>> abjad.NumberedInterval(0).number() 0
- class abjad.pitch.NumberedIntervalClass(number=0)[source]
Numbered interval-class.
Initializes from integer:
>>> abjad.NumberedIntervalClass(-14) NumberedIntervalClass(-2)
Initializes from float:
>>> abjad.NumberedIntervalClass(-14.5) NumberedIntervalClass(-2.5)
Initializes from string:
>>> abjad.NumberedIntervalClass("-14.5") NumberedIntervalClass(-2.5)
>>> abjad.NumberedIntervalClass("P8") NumberedIntervalClass(12)
>>> abjad.NumberedIntervalClass("-P8") NumberedIntervalClass(-12)
Gets direction number of numbered interval-class.
Gets signed string.
- class abjad.pitch.NumberedInversionEquivalentIntervalClass(number=0)[source]
Numbered inversion-equivalent interval-class.
Initializes from integer:
>>> abjad.NumberedInversionEquivalentIntervalClass(0) NumberedInversionEquivalentIntervalClass(0)
>>> abjad.NumberedInversionEquivalentIntervalClass(1) NumberedInversionEquivalentIntervalClass(1)
Initializes from float:
>>> abjad.NumberedInversionEquivalentIntervalClass(1.5) NumberedInversionEquivalentIntervalClass(1.5)
Initializes from string:
>>> abjad.NumberedInversionEquivalentIntervalClass("1") NumberedInversionEquivalentIntervalClass(1)
- class abjad.pitch.NumberedPitch(number=0, *, arrow=None, octave=None)[source]
Numbered pitch.
Initializes from number:
>>> abjad.NumberedPitch(13) NumberedPitch(13)
Initializes from other numbered pitch:
>>> abjad.NumberedPitch(abjad.NumberedPitch(13)) NumberedPitch(13)
Initializes from pitch-class / octave pair:
>>> abjad.NumberedPitch((1, 5)) NumberedPitch(13)
Gets accidental of numbered pitch.
arrow
()Gets arrow of numbered pitch.
get_name_in_locale
([locale])Gets name of numbered pitch name according to
locale
.hertz
()Gets frequency of numbered pitch in Hertz.
interpolate
(stop_pitch, fraction)Interpolates between numbered pitch and
stop_pitch
byfraction
.invert
([axis])Inverts numbered pitch around
axis
.multiply
([n])Multiplies numbered pitch by index
n
.name
()Gets name of numbered pitch.
number
()Gets number of numbered pitch.
octave
()Gets octave of numbered pitch.
Gets pitch-class of numbered pitch.
transpose
([n])Tranposes numbered pitch by
n
semitones.- accidental() Accidental [source]
Gets accidental of numbered pitch.
>>> abjad.NumberedPitchClass(13).accidental() Accidental(name='sharp')
- overridden arrow()[source]
Gets arrow of numbered pitch.
Returns up, down or none.
>>> abjad.NumberedPitch(13).arrow() is None True
>>> abjad.NumberedPitch(13, arrow=abjad.UP).arrow() <Vertical.UP: 1>
>>> abjad.NumberedPitch(13, arrow=abjad.DOWN).arrow() <Vertical.DOWN: -1>
- overridden get_name_in_locale(locale: str | None = None) str [source]
Gets name of numbered pitch name according to
locale
.Set
locale
to"us"
or none.>>> abjad.NumberedPitch(13).name() "cs''"
>>> abjad.NumberedPitch(13).get_name_in_locale(locale="us") 'C#5'
- overridden hertz() float [source]
Gets frequency of numbered pitch in Hertz.
>>> abjad.NumberedPitch(9).hertz() 440.0
>>> abjad.NumberedPitch(0).hertz() 261.6255653005986
>>> abjad.NumberedPitch(12).hertz() 523.2511306011972
- interpolate(stop_pitch, fraction) NumberedPitch [source]
Interpolates between numbered pitch and
stop_pitch
byfraction
.Interpolates from C4 to C5:
>>> start_pitch = abjad.NumberedPitch(0) >>> stop_pitch = abjad.NumberedPitch(12)
>>> start_pitch.interpolate(stop_pitch, 0) NumberedPitch(0)
>>> start_pitch.interpolate(stop_pitch, (1, 4)) NumberedPitch(3)
>>> start_pitch.interpolate(stop_pitch, (1, 2)) NumberedPitch(6)
>>> start_pitch.interpolate(stop_pitch, (3, 4)) NumberedPitch(9)
>>> start_pitch.interpolate(stop_pitch, 1) NumberedPitch(12)
Interpolates from C5 to C4:
>>> start_pitch = abjad.NumberedPitch(12) >>> stop_pitch = abjad.NumberedPitch(0)
>>> start_pitch.interpolate(stop_pitch, 0) NumberedPitch(12)
>>> start_pitch.interpolate(stop_pitch, (1, 4)) NumberedPitch(9)
>>> start_pitch.interpolate(stop_pitch, (1, 2)) NumberedPitch(6)
>>> start_pitch.interpolate(stop_pitch, (3, 4)) NumberedPitch(3)
>>> start_pitch.interpolate(stop_pitch, 1) NumberedPitch(0)
- overridden invert(axis=None) NumberedPitch [source]
Inverts numbered pitch around
axis
.Inverts pitch-class about pitch-class 0 explicitly:
>>> abjad.NumberedPitch(2).invert(0) NumberedPitch(-2)
>>> abjad.NumberedPitch(-2).invert(0) NumberedPitch(2)
Inverts pitch-class about pitch-class 0 implicitly:
>>> abjad.NumberedPitch(2).invert() NumberedPitch(-2)
>>> abjad.NumberedPitch(-2).invert() NumberedPitch(2)
Inverts pitch-class about pitch-class -3:
>>> abjad.NumberedPitch(2).invert(-3) NumberedPitch(-8)
- overridden multiply(n=1) NumberedPitch [source]
Multiplies numbered pitch by index
n
.>>> abjad.NumberedPitch(14).multiply(3) NumberedPitch(42)
- overridden name() str [source]
Gets name of numbered pitch.
>>> abjad.NumberedPitch(13).name() "cs''"
- overridden number() int | float [source]
Gets number of numbered pitch.
>>> abjad.NumberedPitch(13).number() 13
- overridden octave() Octave [source]
Gets octave of numbered pitch.
>>> abjad.NumberedPitch(13).octave() Octave(number=5)
- overridden pitch_class() NumberedPitchClass [source]
Gets pitch-class of numbered pitch.
>>> abjad.NumberedPitch(13).pitch_class() NumberedPitchClass(1)
- overridden transpose(n=0) NumberedPitch [source]
Tranposes numbered pitch by
n
semitones.>>> abjad.NumberedPitch(13).transpose(1) NumberedPitch(14)
- class abjad.pitch.NumberedPitchClass(number=0, *, arrow=None)[source]
Numbered pitch-class.
Initializes from number of semitones:
>>> abjad.NumberedPitchClass(13) NumberedPitchClass(1)
Initializes from pitch name:
>>> abjad.NumberedPitchClass("d") NumberedPitchClass(2)
Initializes from named pitch:
>>> abjad.NumberedPitchClass(abjad.NamedPitch("g,")) NumberedPitchClass(7)
Initializes from numbered pitch:
>>> abjad.NumberedPitchClass(abjad.NumberedPitch(15)) NumberedPitchClass(3)
Initializes from named pitch-class:
>>> abjad.NumberedPitchClass(abjad.NamedPitchClass("e")) NumberedPitchClass(4)
Initializes from pitch-class / octave string:
>>> abjad.NumberedPitchClass("C#5") NumberedPitchClass(1)
Initializes from other numbered pitch-class:
>>> abjad.NumberedPitchClass(abjad.NumberedPitchClass(9)) NumberedPitchClass(9)
Initializes from note:
>>> abjad.NumberedPitchClass(abjad.Note("a'8.")) NumberedPitchClass(9)
Gets accidental.
arrow
()Gets arrow of numbered pitch-class.
invert
([axis])Inverts numbered pitch-class.
multiply
([n])Multiplies pitch-class number by
n
.name
()Gets name of numbered pitch-class.
number
()Gets number.
Gets pitch-class / octave label.
transpose
([n])Transposes numbered pitch-class by index
n
.- overridden accidental() Accidental [source]
Gets accidental.
>>> abjad.NumberedPitchClass(1).accidental() Accidental(name='sharp')
- overridden invert(axis=None) NumberedPitchClass [source]
Inverts numbered pitch-class.
Interprets axis of inversion equal to pitch-class 0.
>>> for n in range(12): ... pitch_class = abjad.NumberedPitchClass(n) ... print(repr(pitch_class), repr(pitch_class.invert())) ... NumberedPitchClass(0) NumberedPitchClass(0) NumberedPitchClass(1) NumberedPitchClass(11) NumberedPitchClass(2) NumberedPitchClass(10) NumberedPitchClass(3) NumberedPitchClass(9) NumberedPitchClass(4) NumberedPitchClass(8) NumberedPitchClass(5) NumberedPitchClass(7) NumberedPitchClass(6) NumberedPitchClass(6) NumberedPitchClass(7) NumberedPitchClass(5) NumberedPitchClass(8) NumberedPitchClass(4) NumberedPitchClass(9) NumberedPitchClass(3) NumberedPitchClass(10) NumberedPitchClass(2) NumberedPitchClass(11) NumberedPitchClass(1)
- overridden multiply(n=1) NumberedPitchClass [source]
Multiplies pitch-class number by
n
.>>> for n in range(12): ... pitch_class = abjad.NumberedPitchClass(n) ... print(repr(pitch_class), repr(pitch_class.multiply(5))) ... NumberedPitchClass(0) NumberedPitchClass(0) NumberedPitchClass(1) NumberedPitchClass(5) NumberedPitchClass(2) NumberedPitchClass(10) NumberedPitchClass(3) NumberedPitchClass(3) NumberedPitchClass(4) NumberedPitchClass(8) NumberedPitchClass(5) NumberedPitchClass(1) NumberedPitchClass(6) NumberedPitchClass(6) NumberedPitchClass(7) NumberedPitchClass(11) NumberedPitchClass(8) NumberedPitchClass(4) NumberedPitchClass(9) NumberedPitchClass(9) NumberedPitchClass(10) NumberedPitchClass(2) NumberedPitchClass(11) NumberedPitchClass(7)
- name() str [source]
Gets name of numbered pitch-class.
>>> abjad.NumberedPitchClass(13).name() 'cs'
- number() int | float [source]
Gets number.
>>> abjad.NumberedPitchClass(1).number() 1
>>> abjad.NumberedPitchClass(13).number() 1
- overridden pitch_class_label() str [source]
Gets pitch-class / octave label.
>>> abjad.NumberedPitchClass(13).pitch_class_label() 'C#'
- overridden transpose(n=0) NumberedPitchClass [source]
Transposes numbered pitch-class by index
n
.>>> for n in range(12): ... pitch_class = abjad.NumberedPitchClass(n) ... print(repr(pitch_class), repr(pitch_class.transpose(-13))) ... NumberedPitchClass(0) NumberedPitchClass(11) NumberedPitchClass(1) NumberedPitchClass(0) NumberedPitchClass(2) NumberedPitchClass(1) NumberedPitchClass(3) NumberedPitchClass(2) NumberedPitchClass(4) NumberedPitchClass(3) NumberedPitchClass(5) NumberedPitchClass(4) NumberedPitchClass(6) NumberedPitchClass(5) NumberedPitchClass(7) NumberedPitchClass(6) NumberedPitchClass(8) NumberedPitchClass(7) NumberedPitchClass(9) NumberedPitchClass(8) NumberedPitchClass(10) NumberedPitchClass(9) NumberedPitchClass(11) NumberedPitchClass(10)
- class abjad.pitch.Octave(number: int = 4)[source]
Octave.
Initializes octave from integer:
>>> abjad.Octave(4) Octave(number=4)
Initializes octave from named pitch:
>>> abjad.Octave(abjad.NamedPitch("cs''")) Octave(number=5)
Initializes octave from other octave:
>>> abjad.Octave(abjad.Octave(2)) Octave(number=2)
>>> octave_1 = abjad.Octave(4) >>> octave_2 = abjad.Octave(4) >>> octave_3 = abjad.Octave(5)
>>> octave_1 == octave_1 True
>>> octave_1 == octave_2 True
>>> octave_1 == octave_3 False
>>> octave_2 == octave_1 True
>>> octave_2 == octave_2 True
>>> octave_2 == octave_3 False
>>> octave_3 == octave_1 False
>>> octave_3 == octave_2 False
>>> octave_3 == octave_3 True
Gets pitch number of first note in octave.
ticks
()Gets LilyPond octave tick string.
- class abjad.pitch.Pitch(argument, accidental=None, arrow=None, octave=None)[source]
Abstract pitch.
arrow
()Gets arrow of pitch.
get_name_in_locale
([locale])Gets name of pitch according to
locale
.hertz
()Gets frequency of pitch in Hertz.
invert
([axis])Inverts pitch about
axis
.multiply
([n])Multiplies pitch by
n
.name
()Gets name of pitch.
number
()Gets number of pitch.
octave
()Gets octave of pitch.
Gets pitch-class of pitch.
transpose
(n)Transposes pitch by index
n
.
- class abjad.pitch.PitchClass(argument)[source]
Abstract pitch-class.
Gets accidental of pitch-class.
invert
([axis])Inverts pitch-class about
axis
.multiply
([n])Multiplies pitch-class by
n
.Gets pitch-class label of pitch-class.
transpose
([n])Transposes pitch-class by index
n
.- accidental() Accidental [source]
Gets accidental of pitch-class.
- class abjad.pitch.StaffPosition(number: int = 0)[source]
Staff position.
Middle line of staff:
>>> abjad.StaffPosition(0) StaffPosition(number=0)
One space below middle line of staff:
>>> abjad.StaffPosition(-1) StaffPosition(number=-1)
One line below middle line of staff:
>>> abjad.StaffPosition(-2) StaffPosition(number=-2)