pitch¶
Classes
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. |
- class abjad.pitch.Accidental(name='natural', arrow=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'
Attributes Summary
Adds
argument
to accidental.Calls accidental on
argument
.Return self==value.
Return a >= b.
Return a > b.
Return hash(self).
Return a <= b.
Returns true or false.
Negates accidental.
Raises not implemented error on accidental.
Return repr(self).
Gets string representation of accidental.
Subtracts
argument
from accidental.Gets symbol of accidental.
Special methods
- __add__(argument)[source]¶
Adds
argument
to accidental.>>> accidental = abjad.Accidental("qs")
>>> accidental + accidental Accidental(name='sharp')
>>> accidental + accidental + accidental Accidental(name='three-quarters sharp')
Returns new accidental.
- overridden __call__(argument)[source]¶
Calls accidental on
argument
.>>> accidental = abjad.Accidental("s")
Calls accidental on pitches:
>>> accidental(abjad.NamedPitch("c''")) NamedPitch("cs''")
>>> accidental(abjad.NamedPitch("cqs''")) NamedPitch("ctqs''")
>>> accidental(abjad.NumberedPitch(12)) NumberedPitch(13)
>>> accidental(abjad.NumberedPitch(12.5)) NumberedPitch(13.5)
Calls accidental on pitch-classes:
>>> accidental(abjad.NamedPitchClass("c")) NamedPitchClass('cs')
>>> accidental(abjad.NamedPitchClass("cqs")) NamedPitchClass('ctqs')
>>> accidental(abjad.NumberedPitchClass(0)) NumberedPitchClass(1)
>>> accidental(abjad.NumberedPitchClass(0.5)) NumberedPitchClass(1.5)
Returns new object of
argument
type.
- overridden __eq__(other)¶
Return self==value.
- overridden __ge__(other)¶
Return a >= b. Computed by @total_ordering from (not a < b).
- overridden __gt__(other)¶
Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
- overridden __hash__()¶
Return hash(self).
- overridden __le__(other)¶
Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- __neg__()[source]¶
Negates accidental.
>>> -abjad.Accidental("ff") Accidental(name='double sharp')
>>> -abjad.Accidental("tqf") Accidental(name='three-quarters sharp')
>>> -abjad.Accidental("f") Accidental(name='sharp')
>>> -abjad.Accidental("") Accidental(name='natural')
>>> -abjad.Accidental("qs") Accidental(name='quarter flat')
>>> -abjad.Accidental("s") Accidental(name='flat')
>>> -abjad.Accidental("tqs") Accidental(name='three-quarters flat')
>>> -abjad.Accidental("ss") Accidental(name='double flat')
Returns new accidental.
- overridden __repr__()¶
Return repr(self).
- overridden __str__()[source]¶
Gets string representation of accidental.
>>> str(abjad.Accidental("ff")) 'ff'
>>> str(abjad.Accidental("tqf")) 'tqf'
>>> str(abjad.Accidental("f")) 'f'
>>> str(abjad.Accidental("")) ''
>>> str(abjad.Accidental("qs")) 'qs'
>>> str(abjad.Accidental("s")) 's'
>>> str(abjad.Accidental("tqs")) 'tqs'
>>> str(abjad.Accidental("ss")) 'ss'
- Return type:
- __sub__(argument)[source]¶
Subtracts
argument
from accidental.>>> accidental = abjad.Accidental("qs")
>>> accidental - accidental Accidental(name='natural')
>>> accidental - accidental - accidental Accidental(name='quarter flat')
Returns new accidental.
Read-only properties
- symbol¶
Gets symbol of accidental.
>>> abjad.Accidental("ff").symbol 'bb'
>>> abjad.Accidental("tqf").symbol 'b~'
>>> abjad.Accidental("f").symbol 'b'
>>> abjad.Accidental("").symbol ''
>>> abjad.Accidental("qs").symbol '+'
>>> abjad.Accidental("s").symbol '#'
>>> abjad.Accidental("tqs").symbol '#+'
>>> abjad.Accidental("ss").symbol '##'
- class abjad.pitch.Interval(argument)[source]¶
Abstract interval.
Attributes Summary
Compares repr formats.
Return a >= b.
Return a > b.
Hashes interval.
Return a <= b.
Is true when interval is less than
argument
Gets cents of interval.
Gets direction number of interval
Gets interval-class of interval.
Gets number of interval.
Gets octaves of interval.
Gets semitones of interval.
Transposes
pitch_carrier
by interval.Special methods
- overridden __ge__(other)¶
Return a >= b. Computed by @total_ordering from (not a < b).
- overridden __gt__(other)¶
Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
- overridden __le__(other)¶
Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- overridden __lt__(argument)[source]¶
Is true when interval is less than
argument
Returns true or false.
Methods
Read-only properties
- cents¶
Gets cents of interval.
Returns nonnegative number.
- direction_number¶
Gets direction number of interval
Returns integer.
- interval_class¶
Gets interval-class of interval.
Returns interval-class.
- number¶
Gets number of interval.
Returns integer.
- octaves¶
Gets octaves of interval.
Returns nonnegative number.
- semitones¶
Gets semitones of interval.
Returns integer or float.
- class abjad.pitch.IntervalClass(argument)[source]¶
Abstract interval-class.
Attributes Summary
Gets absolute value of interval-class.
Compares
number
.Return a >= b.
Return a > b.
Hashes interval-class.
Return a <= b.
Compares
number
.Gets number of interval-class.
Transposes
pitch_carrier
by interval-class.Special methods
- overridden __ge__(other)¶
Return a >= b. Computed by @total_ordering from (not a < b).
- overridden __gt__(other)¶
Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
- overridden __le__(other)¶
Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
Methods
- transpose(pitch_carrier)[source]¶
Transposes
pitch_carrier
by interval-class.Returns new pitch carrier.
Read-only properties
- number¶
Gets number of interval-class.
Returns number.
- 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')
Attributes Summary
Gets absolute value of named interval.
Adds
argument
to named interval.Copies named interval.
Compares
name
.Coerce to semitones as float.
Hashes named interval.
Compares
semitones
.Multiplies named interval by
argument
Negates named interval.
Adds named interval to
argument
Gets repr.
Multiplies
argument
by named interval.Subtracts
argument
from named interval.Gets direction number of named interval.
Makes named interval calculated from
pitch_carrier_1
topitch_carrier_2
.Gets named interval class.
Gets name of named interval.
Gets number of named interval.
Gets octaves of interval.
Gets quality of named interval.
Gets semitones of named interval.
Gets staff spaces of named interval.
Transposes
pitch_carrier
by named interval.Special methods
- __abs__()[source]¶
Gets absolute value of named interval.
>>> abs(abjad.NamedInterval("+M9")) NamedInterval('+M9')
>>> abs(abjad.NamedInterval("-M9")) NamedInterval('+M9')
- Return type:
- __add__(argument)[source]¶
Adds
argument
to named interval.>>> abjad.NamedInterval("M9") + abjad.NamedInterval("M2") NamedInterval('+M10')
- Return type:
- __copy__(*arguments)[source]¶
Copies named interval. :rtype:
NamedInterval
>>> import copy
>>> copy.copy(abjad.NamedInterval("+M9")) NamedInterval('+M9')
- overridden __eq__(argument)[source]¶
Compares
name
.>>> interval_1 = abjad.NamedInterval("m2") >>> interval_2 = abjad.NamedInterval("m2") >>> interval_3 = abjad.NamedInterval("m9")
>>> interval_1 == interval_1 True
>>> interval_1 == interval_2 True
>>> interval_1 == interval_3 False
>>> interval_2 == interval_1 True
>>> interval_2 == interval_2 True
>>> interval_2 == interval_3 False
>>> interval_3 == interval_1 False
>>> interval_3 == interval_2 False
>>> interval_3 == interval_3 True
- Return type:
- overridden __lt__(argument)[source]¶
Compares
semitones
.>>> abjad.NamedInterval("+M9") < abjad.NamedInterval("+M10") True
>>> abjad.NamedInterval("+m9") < abjad.NamedInterval("+M9") True
>>> abjad.NamedInterval("+M9") < abjad.NamedInterval("+M2") False
- Return type:
- __mul__(argument)[source]¶
Multiplies named interval by
argument
>>> 3 * abjad.NamedInterval("+M9") NamedInterval('+A25')
- Return type:
- __neg__()[source]¶
Negates named interval.
>>> -abjad.NamedInterval("+M9") NamedInterval('-M9')
>>> -abjad.NamedInterval("-M9") NamedInterval('+M9')
- Return type:
- __radd__(argument)[source]¶
Adds named interval to
argument
>>> abjad.NamedInterval("M9") + abjad.NamedInterval("M2") NamedInterval('+M10')
- Return type:
- __rmul__(argument)[source]¶
Multiplies
argument
by named interval.>>> abjad.NamedInterval("+M9") * 3 NamedInterval('+A25')
- Return type:
- __sub__(argument)[source]¶
Subtracts
argument
from named interval.>>> abjad.NamedInterval("+M9") - abjad.NamedInterval("+M2") NamedInterval('+P8')
>>> abjad.NamedInterval("+M2") - abjad.NamedInterval("+M9") NamedInterval('-P8')
- Return type:
Methods
- overridden transpose(pitch_carrier)[source]¶
Transposes
pitch_carrier
by named interval.Transposes chord:
>>> chord = abjad.Chord("<c' e' g'>4")
>>> interval = abjad.NamedInterval("+m2") >>> interval.transpose(chord) Chord("<df' f' af'>4")
Returns new (copied) object of
pitch_carrier
type.
Class & static methods
- classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]¶
Makes named interval calculated from
pitch_carrier_1
topitch_carrier_2
.>>> abjad.NamedInterval.from_pitch_carriers( ... abjad.NamedPitch(-2), ... abjad.NamedPitch(12), ... ) NamedInterval('+M9')
>>> abjad.NamedInterval.from_pitch_carriers( ... abjad.NamedPitch("css'"), ... abjad.NamedPitch("cff'"), ... ) NamedInterval('-AAAA1')
>>> abjad.NamedInterval.from_pitch_carriers( ... abjad.NamedPitch("ds'"), ... abjad.NamedPitch("ef''"), ... ) NamedInterval('+d9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "cs'''") NamedInterval('+A15')
>>> abjad.NamedInterval.from_pitch_carriers("c", "cqs") NamedInterval('+P+1')
>>> abjad.NamedInterval.from_pitch_carriers("cf'", "bs") NamedInterval('-dd2')
>>> abjad.NamedInterval.from_pitch_carriers("cff'", "aqs") NamedInterval('-ddd+3')
>>> abjad.NamedInterval.from_pitch_carriers("cff'", "atqs") NamedInterval('-dddd+3')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "d''") NamedInterval('+M9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "df''") NamedInterval('+m9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "dff''") NamedInterval('+d9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "dfff''") NamedInterval('+dd9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "dffff''") NamedInterval('+ddd9')
- Return type:
Read-only properties
- overridden direction_number¶
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¶
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')
- name¶
Gets name of named interval.
>>> abjad.NamedInterval("+M9").name '+M9'
- overridden number¶
Gets number of named interval.
>>> abjad.NamedInterval("+M9").number 9
- overridden octaves¶
Gets octaves of interval.
- quality¶
Gets quality of named interval.
- overridden semitones¶
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¶
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.
Initializes from name:
>>> abjad.NamedIntervalClass("-M9") NamedIntervalClass('-M2')
Attributes Summary
Gets absolute value of named interval-class.
Adds
argument
to named interval-class.Is true when
argument
is a named interval-class with direction number, quality string and number equal to those of this named interval-class.Coerce to float.
Hashes named interval-class.
Is true when
argument
is a named interval class with a number greater than that of this named interval.Adds interval-class to
argument
Gets repr.
Subtracts
argument
from named interval-class.Gets direction number of named interval-class.
Makes named interval-class from
pitch_carrier_1
andpitch_carrier_2
Gets name of named interval-class.
Gets quality of named interval-class.
Special methods
- overridden __abs__()[source]¶
Gets absolute value of named interval-class.
>>> abs(abjad.NamedIntervalClass("-M9")) NamedIntervalClass('+M2')
Returns new named interval-class.
- overridden __eq__(argument)[source]¶
Is true when
argument
is a named interval-class with direction number, quality string and number equal to those of this named interval-class.>>> interval_class_1 = abjad.NamedIntervalClass("P1") >>> interval_class_2 = abjad.NamedIntervalClass("P1") >>> interval_class_3 = abjad.NamedIntervalClass("m2")
>>> interval_class_1 == interval_class_1 True
>>> interval_class_1 == interval_class_2 True
>>> interval_class_1 == interval_class_3 False
>>> interval_class_2 == interval_class_1 True
>>> interval_class_2 == interval_class_2 True
>>> interval_class_2 == interval_class_3 False
>>> interval_class_3 == interval_class_1 False
>>> interval_class_3 == interval_class_2 False
>>> interval_class_3 == interval_class_3 True
Returns true or false.
-
(
IntervalClass
).__ge__(other)¶ Return a >= b. Computed by @total_ordering from (not a < b).
-
(
IntervalClass
).__gt__(other)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
-
(
IntervalClass
).__le__(other)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- overridden __lt__(argument)[source]¶
Is true when
argument
is a named interval class with a number greater than that of this named interval.>>> interval_class_1 = abjad.NamedIntervalClass("P1") >>> interval_class_2 = abjad.NamedIntervalClass("P1") >>> interval_class_3 = abjad.NamedIntervalClass("m2")
>>> interval_class_1 < interval_class_1 False
>>> interval_class_1 < interval_class_2 False
>>> interval_class_1 < interval_class_3 True
>>> interval_class_2 < interval_class_1 False
>>> interval_class_2 < interval_class_2 False
>>> interval_class_2 < interval_class_3 True
>>> interval_class_3 < interval_class_1 False
>>> interval_class_3 < interval_class_2 False
>>> interval_class_3 < interval_class_3 False
- Return type:
- __sub__(argument)[source]¶
Subtracts
argument
from named interval-class.Returns new named interval-class.
Methods
-
(
IntervalClass
).transpose(pitch_carrier)¶ Transposes
pitch_carrier
by interval-class.Returns new pitch carrier.
Class & static methods
- classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]¶
Makes named interval-class from
pitch_carrier_1
andpitch_carrier_2
>>> abjad.NamedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(-2), ... abjad.NamedPitch(12), ... ) NamedIntervalClass('+M2')
>>> abjad.NamedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(0), ... abjad.NamedPitch(12), ... ) NamedIntervalClass('+P8')
>>> abjad.NamedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(12), ... ) NamedIntervalClass('P1')
>>> abjad.NamedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(-3), ... ) NamedIntervalClass('-m3')
>>> abjad.NamedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(9), ... ) NamedIntervalClass('-m3')
Returns newly constructed named interval-class.
Read-only properties
- direction_number¶
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
Returns -1, 0 or 1.
- name¶
Gets name of named interval-class.
>>> abjad.NamedIntervalClass("-M9").name '-M2'
Returns string.
-
(
IntervalClass
).number¶ Gets number of interval-class.
Returns number.
- quality¶
Gets quality of named interval-class.
Returns string.
- 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')
Attributes Summary
Compares
name
.Hashes named inversion-equivalent interval-class.
Makes named inversion-equivalent interval-class from
pitch_carrier_1
andpitch_carrier_2
.Special methods
-
(
NamedIntervalClass
).__abs__()¶ Gets absolute value of named interval-class.
>>> abs(abjad.NamedIntervalClass("-M9")) NamedIntervalClass('+M2')
Returns new named interval-class.
-
(
NamedIntervalClass
).__add__(argument)¶ Adds
argument
to named interval-class.Returns new named interval-class.
- overridden __eq__(argument)[source]¶
Compares
name
.>>> class_ = abjad.NamedInversionEquivalentIntervalClass >>> interval_class_1 = class_("P1") >>> interval_class_2 = class_("P1") >>> interval_class_3 = class_("m2")
>>> interval_class_1 == interval_class_1 True
>>> interval_class_1 == interval_class_2 True
>>> interval_class_1 == interval_class_3 False
>>> interval_class_2 == interval_class_1 True
>>> interval_class_2 == interval_class_2 True
>>> interval_class_2 == interval_class_3 False
>>> interval_class_3 == interval_class_1 False
>>> interval_class_3 == interval_class_2 False
>>> interval_class_3 == interval_class_3 True
Returns true or false.
-
(
NamedIntervalClass
).__float__()¶ Coerce to float.
Returns float.
-
(
IntervalClass
).__ge__(other)¶ Return a >= b. Computed by @total_ordering from (not a < b).
-
(
IntervalClass
).__gt__(other)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
-
(
IntervalClass
).__le__(other)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
-
(
NamedIntervalClass
).__lt__(argument)¶ Is true when
argument
is a named interval class with a number greater than that of this named interval.>>> interval_class_1 = abjad.NamedIntervalClass("P1") >>> interval_class_2 = abjad.NamedIntervalClass("P1") >>> interval_class_3 = abjad.NamedIntervalClass("m2")
>>> interval_class_1 < interval_class_1 False
>>> interval_class_1 < interval_class_2 False
>>> interval_class_1 < interval_class_3 True
>>> interval_class_2 < interval_class_1 False
>>> interval_class_2 < interval_class_2 False
>>> interval_class_2 < interval_class_3 True
>>> interval_class_3 < interval_class_1 False
>>> interval_class_3 < interval_class_2 False
>>> interval_class_3 < interval_class_3 False
- Return type:
-
(
NamedIntervalClass
).__radd__(argument)¶ Adds interval-class to
argument
Returns new named interval-class.
-
(
NamedIntervalClass
).__repr__()¶ Gets repr.
-
(
NamedIntervalClass
).__sub__(argument)¶ Subtracts
argument
from named interval-class.Returns new named interval-class.
Methods
-
(
IntervalClass
).transpose(pitch_carrier)¶ Transposes
pitch_carrier
by interval-class.Returns new pitch carrier.
Class & static methods
- overridden classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]¶
Makes named inversion-equivalent interval-class from
pitch_carrier_1
andpitch_carrier_2
.>>> class_ = abjad.NamedInversionEquivalentIntervalClass >>> class_.from_pitch_carriers( ... abjad.NamedPitch(-2), ... abjad.NamedPitch(12), ... ) NamedInversionEquivalentIntervalClass('+M2')
Returns new named inversion-equivalent interval-class.
Read-only properties
-
(
NamedIntervalClass
).direction_number¶ 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
Returns -1, 0 or 1.
-
(
NamedIntervalClass
).name¶ Gets name of named interval-class.
>>> abjad.NamedIntervalClass("-M9").name '-M2'
Returns string.
-
(
IntervalClass
).number¶ Gets number of interval-class.
Returns number.
-
(
NamedIntervalClass
).quality¶ Gets quality of named interval-class.
Returns string.
-
(
- 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''")
Attributes Summary
Adds named pitch to
interval
.Copies named pitch.
Is true when
argument
is a named pitch equal to this named pitch.Hashes numbered pitch.
Is true when named pitch is less than or equal to
argument
.Is true when named pitch is less than
argument
.Right-addition not defined on named pitches.
Gets repr.
Subtracts
argument
from named pitch.Gets accidental of named pitch.
Gets arrow of named pitch.
Makes named pitch from
hertz
.Gets name of named pitch according to
locale
.Gets frequency of named pitch in Hertz.
Inverts named pitch around
axis
.Multiplies named pitch.
Gets name of named pitch.
Gets number of named pitch.
Gets octave of named pitch.
Gets pitch-class of named pitch.
Respells named pitch with
accidental
.Reduce alteration to between -2 and 2 while maintaining identical pitch number.
Transposes named pitch by index
n
.Special methods
- __add__(interval)[source]¶
Adds named pitch to
interval
.>>> abjad.NamedPitch("cs''") + abjad.NamedInterval("-M2") NamedPitch("b'")
>>> abjad.NamedPitch("cs''") + abjad.NamedInterval("P1") NamedPitch("cs''")
>>> abjad.NamedPitch("cs''") + abjad.NamedInterval("+M2") NamedPitch("ds''")
- Return type:
- __copy__(*arguments)[source]¶
Copies named pitch. :rtype:
NamedPitch
>>> import copy
>>> copy.copy(abjad.NamedPitch("c''")) NamedPitch("c''")
>>> copy.copy(abjad.NamedPitch("cs''")) NamedPitch("cs''")
>>> copy.copy(abjad.NamedPitch("df''")) NamedPitch("df''")
Copies arrowed pitch:
>>> pitch = abjad.NamedPitch("cs''", arrow=abjad.UP) >>> copy.copy(pitch) NamedPitch("cs''", arrow=Vertical.UP)
- overridden __eq__(argument)[source]¶
Is true when
argument
is a named pitch equal to this named pitch.>>> pitch_1 = abjad.NamedPitch("fs") >>> pitch_2 = abjad.NamedPitch("fs") >>> pitch_3 = abjad.NamedPitch("gf")
>>> pitch_1 == pitch_1 True
>>> pitch_1 == pitch_2 True
>>> pitch_1 == pitch_3 False
>>> pitch_2 == pitch_1 True
>>> pitch_2 == pitch_2 True
>>> pitch_2 == pitch_3 False
>>> pitch_3 == pitch_1 False
>>> pitch_3 == pitch_2 False
>>> pitch_3 == pitch_3 True
Returns true or false.
- Return type:
- overridden __le__(argument)[source]¶
Is true when named pitch is less than or equal to
argument
.>>> pitch_1 = abjad.NamedPitch("fs") >>> pitch_2 = abjad.NamedPitch("fs") >>> pitch_3 = abjad.NamedPitch("gf")
>>> pitch_1 <= pitch_1 True
>>> pitch_1 <= pitch_2 True
>>> pitch_1 <= pitch_3 True
>>> pitch_2 <= pitch_1 True
>>> pitch_2 <= pitch_2 True
>>> pitch_2 <= pitch_3 True
>>> pitch_3 <= pitch_1 False
>>> pitch_3 <= pitch_2 False
>>> pitch_3 <= pitch_3 True
- Return type:
- overridden __lt__(argument)[source]¶
Is true when named pitch is less than
argument
.>>> pitch_1 = abjad.NamedPitch("fs") >>> pitch_2 = abjad.NamedPitch("fs") >>> pitch_3 = abjad.NamedPitch("gf")
>>> pitch_1 < pitch_1 False
>>> pitch_1 < pitch_2 False
>>> pitch_1 < pitch_3 True
>>> pitch_2 < pitch_1 False
>>> pitch_2 < pitch_2 False
>>> pitch_2 < pitch_3 True
>>> pitch_3 < pitch_1 False
>>> pitch_3 < pitch_2 False
>>> pitch_3 < pitch_3 False
Returns true or false.
- Return type:
- __radd__(interval)[source]¶
Right-addition not defined on named pitches.
>>> abjad.NamedPitch("cs'").__radd__(1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/trevor/abjad/abjad/pitch.py", line 4777, in __radd__ raise NotImplementedError(message) NotImplementedError: right-addition not defined on NamedPitch.
- __sub__(argument)[source]¶
Subtracts
argument
from named pitch.>>> abjad.NamedPitch("cs''") - abjad.NamedPitch("b'") NamedInterval('-M2')
>>> abjad.NamedPitch("cs''") - abjad.NamedPitch("fs''") NamedInterval('+P4')
- Return type:
Methods
- overridden get_name(locale=None)[source]¶
Gets name of named pitch according to
locale
.>>> abjad.NamedPitch("cs''").get_name() "cs''"
>>> abjad.NamedPitch("cs''").get_name(locale="us") 'C#5'
Set
locale
to'us'
or none.- Return type:
- overridden invert(axis=None)[source]¶
Inverts named pitch around
axis
.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')
Interprets none-valued
axis
equal to middle C.- Return type:
- overridden multiply(n=1)[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''")
- Return type:
- 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()[source]¶
Reduce alteration to between -2 and 2 while maintaining identical pitch number. :rtype:
NamedPitch
>>> abjad.NamedPitch("cssqs'").simplify() NamedPitch("dqs'")
>>> abjad.NamedPitch("cfffqf'").simplify() NamedPitch('aqf')
>>> float(abjad.NamedPitch("cfffqf'").simplify()) == float(abjad.NamedPitch("aqf")) True
Note
LilyPond by default only supports accidentals from double-flat to double-sharp.
Returns named pitch.
- overridden transpose(n=0)[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')
- Return type:
Class & static methods
- overridden classmethod from_hertz(hertz)[source]¶
Makes named pitch from
hertz
.>>> abjad.NamedPitch.from_hertz(440) NamedPitch("a'")
REGRESSION. Returns c’’ (C5) and not c’ (C4):
>>> abjad.NamedPitch.from_hertz(519) NamedPitch("c''")
- Return type:
Read-only properties
- accidental¶
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¶
Gets arrow of named pitch.
>>> 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)
Returns up, down or none.
- overridden hertz¶
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 name¶
Gets name of named pitch.
>>> abjad.NamedPitch("c''").name "c''"
>>> abjad.NamedPitch("cs''").name "cs''"
>>> abjad.NamedPitch("df''").name "df''"
- overridden number¶
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¶
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¶
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')
- 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')
Attributes Summary
Adds
named_interval
to named pitch-class.Compares string formats.
Hashes named pitch-class.
Compares
number
.Right-addition not defined on named pitch-classes.
Gets repr.
Subtracts
argument
from named pitch-class.Gets accidental.
Gets arrow of named pitch-class.
Inverts named pitch-class.
Multiplies named pitch-class by
n
.Gets name of named pitch-class.
Gets number.
Gets pitch-class label.
Transposes named pitch-class by index named interval
n
.Special methods
- __add__(named_interval)[source]¶
Adds
named_interval
to named pitch-class.>>> abjad.NamedPitchClass("cs") + abjad.NamedInterval("+M9") NamedPitchClass('ds')
>>> abjad.NamedPitchClass("cs") + abjad.NamedInterval("-M9") NamedPitchClass('b')
- Return type:
- overridden __eq__(argument)[source]¶
Compares string formats.
>>> pitch_class_1 = abjad.NamedPitchClass("cs") >>> pitch_class_2 = abjad.NamedPitchClass("cs") >>> pitch_class_3 = abjad.NamedPitchClass("df")
>>> pitch_class_1 == pitch_class_1 True
>>> pitch_class_1 == pitch_class_2 True
>>> pitch_class_1 == pitch_class_3 False
>>> pitch_class_2 == pitch_class_1 True
>>> pitch_class_2 == pitch_class_2 True
>>> pitch_class_2 == pitch_class_3 False
>>> pitch_class_3 == pitch_class_1 False
>>> pitch_class_3 == pitch_class_2 False
>>> pitch_class_3 == pitch_class_3 True
- Return type:
-
(
PitchClass
).__float__()¶ Coerce to float.
Returns float.
-
(
PitchClass
).__ge__(other)¶ Return a >= b. Computed by @total_ordering from (not a < b).
-
(
PitchClass
).__gt__(other)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
-
(
PitchClass
).__le__(other)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- overridden __lt__(argument)[source]¶
Compares
number
.>>> abjad.NamedPitchClass("cs") < abjad.NamedPitchClass("d") True
>>> abjad.NamedPitchClass("d") < abjad.NamedPitchClass("cs") False
- Return type:
- __radd__(interval)[source]¶
Right-addition not defined on named pitch-classes.
>>> abjad.NamedPitchClass("cs").__radd__(1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/trevor/abjad/abjad/pitch.py", line 3686, in __radd__ raise NotImplementedError(message) NotImplementedError: right-addition not defined on NamedPitchClass.
- __sub__(argument)[source]¶
Subtracts
argument
from named pitch-class.>>> abjad.NamedPitchClass("cs") - abjad.NamedPitchClass("g") NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedPitchClass("c") - abjad.NamedPitchClass("cf") NamedInversionEquivalentIntervalClass('+A1')
>>> abjad.NamedPitchClass("cf") - abjad.NamedPitchClass("c") NamedInversionEquivalentIntervalClass('+A1')
- Return type:
Methods
- overridden multiply(n=1)[source]¶
Multiplies named pitch-class by
n
.>>> abjad.NamedPitchClass("cs").multiply(3) NamedPitchClass('ef')
- Return type:
- overridden transpose(n=0)[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')
- Return type:
Read-only properties
- overridden accidental¶
Gets accidental.
>>> abjad.NamedPitchClass("cs").accidental Accidental(name='sharp')
- arrow¶
Gets arrow of named pitch-class.
Returns up, down or none.
- name¶
Gets name of named pitch-class.
>>> abjad.NamedPitchClass("cs").name 'cs'
- number¶
Gets number.
>>> abjad.NamedPitchClass("cs").number 1
- overridden pitch_class_label¶
Gets pitch-class label.
>>> abjad.NamedPitchClass("cs").pitch_class_label 'C#'
- 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)
Attributes Summary
Absolute value of numbered interval.
Adds
argument
to numbered interval.Copies numbered interval.
Compares
number
.Coerce to float.
Hashes numbered interval.
Is true when
argument
is a numbered interval with same direction number as this numbered interval and with number greater than that of this numbered interval.Negates numbered interval.
Adds numbered interval to
argument
Gets repr.
Subtracts
argument
from numbered interval.Gets direction number of numbered interval.
Makes numbered interval from
pitch_carrier_1
andpitch_carrier_2
.Gets numbered interval class.
Gets number of numbered interval.
Gets octaves of interval.
Gets semitones corresponding to numbered interval.
Gets signed string.
Transposes
pitch_carrier
Special methods
- __abs__()[source]¶
Absolute value of numbered interval.
>>> abs(abjad.NumberedInterval(-14)) NumberedInterval(14)
- Return type:
- __add__(argument)[source]¶
Adds
argument
to numbered interval.>>> abjad.NumberedInterval(3) + abjad.NumberedInterval(14) NumberedInterval(17)
>>> abjad.NumberedInterval(3) + abjad.NumberedInterval(-14) NumberedInterval(-11)
- Return type:
- __copy__()[source]¶
Copies numbered interval. :rtype:
NumberedInterval
>>> import copy
>>> copy.copy(abjad.NumberedInterval(-14)) NumberedInterval(-14)
- overridden __eq__(argument)[source]¶
Compares
number
.>>> interval_1 = abjad.NumberedInterval(12) >>> interval_2 = abjad.NumberedInterval(12) >>> interval_3 = abjad.NumberedInterval(13)
>>> interval_1 == interval_1 True
>>> interval_1 == interval_2 True
>>> interval_1 == interval_3 False
>>> interval_2 == interval_1 True
>>> interval_2 == interval_2 True
>>> interval_2 == interval_3 False
>>> interval_3 == interval_1 False
>>> interval_3 == interval_2 False
>>> interval_3 == interval_3 True
- Return type:
- overridden __lt__(argument)[source]¶
Is true when
argument
is a numbered interval with same direction number as this numbered interval and with number greater than that of this numbered interval.>>> interval_1 = abjad.NumberedInterval(12) >>> interval_2 = abjad.NumberedInterval(12) >>> interval_3 = abjad.NumberedInterval(13)
>>> interval_1 < interval_1 False
>>> interval_1 < interval_2 False
>>> interval_1 < interval_3 True
>>> interval_2 < interval_1 False
>>> interval_2 < interval_2 False
>>> interval_2 < interval_3 True
>>> interval_3 < interval_1 False
>>> interval_3 < interval_2 False
>>> interval_3 < interval_3 False
Returns true or false.
- Return type:
- __neg__()[source]¶
Negates numbered interval.
>>> -abjad.NumberedInterval(-14) NumberedInterval(14)
- Return type:
- __radd__(argument)[source]¶
Adds numbered interval to
argument
>>> interval = abjad.NumberedInterval(14) >>> abjad.NumberedInterval(3).__radd__(interval) NumberedInterval(17)
>>> interval = abjad.NumberedInterval(-14) >>> abjad.NumberedInterval(3).__radd__(interval) NumberedInterval(-11)
- Return type:
Methods
- overridden transpose(pitch_carrier)[source]¶
Transposes
pitch_carrier
Transposes chord:
>>> chord = abjad.Chord("<c' e' g'>4")
>>> interval = abjad.NumberedInterval(1) >>> interval.transpose(chord) Chord("<df' f' af'>4")
Returns newly constructed object of
pitch_carrier
type.
Class & static methods
- classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]¶
Makes numbered interval from
pitch_carrier_1
andpitch_carrier_2
.>>> abjad.NumberedInterval.from_pitch_carriers( ... abjad.NamedPitch(-2), ... abjad.NamedPitch(12), ... ) NumberedInterval(14)
>>> abjad.NumberedInterval.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(12), ... ) NumberedInterval(0)
>>> abjad.NumberedInterval.from_pitch_carriers( ... abjad.NamedPitch(9), ... abjad.NamedPitch(12), ... ) NumberedInterval(3)
>>> abjad.NumberedInterval.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(9), ... ) NumberedInterval(-3)
>>> abjad.NumberedInterval.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(-2), ... ) NumberedInterval(-14)
- Return type:
Read-only properties
- overridden direction_number¶
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¶
Gets numbered interval class.
- overridden number¶
Gets number of numbered interval.
>>> abjad.NumberedInterval(-14).number -14
>>> abjad.NumberedInterval(-2).number -2
>>> abjad.NumberedInterval(0).number 0
- overridden octaves¶
Gets octaves of interval.
- overridden semitones¶
Gets semitones corresponding to numbered interval.
>>> abjad.NumberedInterval(-14).semitones -14
- signed_string¶
Gets signed string.
- 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)
Attributes Summary
Gets absolute value of numbered interval-class.
Adds
argument
to numbered interval-class.Compares
number
.Coerce to semitones as float.
Hashes numbered interval-class.
Compares
number
.Adds
argument
to numbered interval-class.Gets repr.
Subtracts
argument
from numbered interval-class.Gets direction number of numbered interval-class.
Makes numbered interval-class from
pitch_carrier_1
andpitch_carrier_2
Gets signed string.
Special methods
- overridden __abs__()[source]¶
Gets absolute value of numbered interval-class.
Returns new numbered interval-class.
- __add__(argument)[source]¶
Adds
argument
to numbered interval-class.Returns new numbered interval-class.
- overridden __eq__(argument)[source]¶
Compares
number
.>>> interval_class_1 = abjad.NumberedIntervalClass(0) >>> interval_class_2 = abjad.NumberedIntervalClass(0) >>> interval_class_3 = abjad.NumberedIntervalClass(1)
>>> interval_class_1 == interval_class_1 True
>>> interval_class_1 == interval_class_2 True
>>> interval_class_1 == interval_class_3 False
>>> interval_class_2 == interval_class_1 True
>>> interval_class_2 == interval_class_2 True
>>> interval_class_2 == interval_class_3 False
>>> interval_class_3 == interval_class_1 False
>>> interval_class_3 == interval_class_2 False
>>> interval_class_3 == interval_class_3 True
- Return type:
-
(
IntervalClass
).__ge__(other)¶ Return a >= b. Computed by @total_ordering from (not a < b).
-
(
IntervalClass
).__gt__(other)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
-
(
IntervalClass
).__le__(other)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- overridden __lt__(argument)[source]¶
Compares
number
.>>> interval_class_1 = abjad.NumberedIntervalClass(0) >>> interval_class_2 = abjad.NumberedIntervalClass(0) >>> interval_class_3 = abjad.NumberedIntervalClass(1)
>>> interval_class_1 < interval_class_1 False
>>> interval_class_1 < interval_class_2 False
>>> interval_class_1 < interval_class_3 True
>>> interval_class_2 < interval_class_1 False
>>> interval_class_2 < interval_class_2 False
>>> interval_class_2 < interval_class_3 True
>>> interval_class_3 < interval_class_1 False
>>> interval_class_3 < interval_class_2 False
>>> interval_class_3 < interval_class_3 False
Returns true or false.
- __radd__(argument)[source]¶
Adds
argument
to numbered interval-class.Returns new numbered interval-class.
- __sub__(argument)[source]¶
Subtracts
argument
from numbered interval-class.Returns new numbered interval-class.
Methods
-
(
IntervalClass
).transpose(pitch_carrier)¶ Transposes
pitch_carrier
by interval-class.Returns new pitch carrier.
Class & static methods
- classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]¶
Makes numbered interval-class from
pitch_carrier_1
andpitch_carrier_2
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(-2), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(2)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(0), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(9), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(9), ... ) NumberedIntervalClass(-3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(0)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(24), ... abjad.NamedPitch(0), ... ) NumberedIntervalClass(-12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(-2), ... ) NumberedIntervalClass(-2)
Returns numbered interval-class.
- Return type:
Read-only properties
- direction_number¶
Gets direction number of numbered interval-class.
Returns -1, 0 or 1.
-
(
IntervalClass
).number¶ Gets number of interval-class.
Returns number.
- signed_string¶
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)
Attributes Summary
Gets absolute value of numbered inversion-equivalent interval-class.
Compares
number
.Negates numbered inversion-equivalent interval-class.
Gets repr.
Special methods
- overridden __abs__()[source]¶
Gets absolute value of numbered inversion-equivalent interval-class.
>>> abs(abjad.NumberedInversionEquivalentIntervalClass(0)) NumberedInversionEquivalentIntervalClass(0)
>>> abs(abjad.NumberedInversionEquivalentIntervalClass(1.5)) NumberedInversionEquivalentIntervalClass(1.5)
Returns new numbered inversion-equivalent interval-class.
-
(
NumberedIntervalClass
).__add__(argument)¶ Adds
argument
to numbered interval-class.Returns new numbered interval-class.
-
(
NumberedIntervalClass
).__eq__(argument)¶ Compares
number
.>>> interval_class_1 = abjad.NumberedIntervalClass(0) >>> interval_class_2 = abjad.NumberedIntervalClass(0) >>> interval_class_3 = abjad.NumberedIntervalClass(1)
>>> interval_class_1 == interval_class_1 True
>>> interval_class_1 == interval_class_2 True
>>> interval_class_1 == interval_class_3 False
>>> interval_class_2 == interval_class_1 True
>>> interval_class_2 == interval_class_2 True
>>> interval_class_2 == interval_class_3 False
>>> interval_class_3 == interval_class_1 False
>>> interval_class_3 == interval_class_2 False
>>> interval_class_3 == interval_class_3 True
- Return type:
-
(
NumberedIntervalClass
).__float__()¶ Coerce to semitones as float.
Returns float.
-
(
IntervalClass
).__ge__(other)¶ Return a >= b. Computed by @total_ordering from (not a < b).
-
(
IntervalClass
).__gt__(other)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
-
(
NumberedIntervalClass
).__hash__()¶ Hashes numbered interval-class.
Returns integer.
-
(
IntervalClass
).__le__(other)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- __neg__()[source]¶
Negates numbered inversion-equivalent interval-class.
>>> -abjad.NumberedInversionEquivalentIntervalClass(0) NumberedInversionEquivalentIntervalClass(0)
>>> -abjad.NumberedInversionEquivalentIntervalClass(1.5) NumberedInversionEquivalentIntervalClass(1.5)
Returns new numbered inversion-equivalent interval-class.
-
(
NumberedIntervalClass
).__radd__(argument)¶ Adds
argument
to numbered interval-class.Returns new numbered interval-class.
-
(
NumberedIntervalClass
).__sub__(argument)¶ Subtracts
argument
from numbered interval-class.Returns new numbered interval-class.
Methods
-
(
IntervalClass
).transpose(pitch_carrier)¶ Transposes
pitch_carrier
by interval-class.Returns new pitch carrier.
Class & static methods
-
classmethod (
NumberedIntervalClass
).from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)¶ Makes numbered interval-class from
pitch_carrier_1
andpitch_carrier_2
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(-2), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(2)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(0), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(9), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(9), ... ) NumberedIntervalClass(-3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(12), ... ) NumberedIntervalClass(0)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(24), ... abjad.NamedPitch(0), ... ) NumberedIntervalClass(-12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers( ... abjad.NamedPitch(12), ... abjad.NamedPitch(-2), ... ) NumberedIntervalClass(-2)
Returns numbered interval-class.
- Return type:
Read-only properties
-
(
NumberedIntervalClass
).direction_number¶ Gets direction number of numbered interval-class.
Returns -1, 0 or 1.
-
(
IntervalClass
).number¶ Gets number of interval-class.
Returns number.
-
(
NumberedIntervalClass
).signed_string¶ Gets signed string.
- 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)
Attributes Summary
Adds
argument
to numbered pitch.Is true when
argument
is a numbered pitch withnumber
the same as this numbered pitch.Hashes numbered pitch.
Is true when
argument
can be coerced to a numbered pitch and when this numbered pitch is less or equal toargument
.Is true when
argument
can be coerced to a numbered pitch and when this numbered pitch is less thanargument
.Negates numbered pitch.
Adds numbered pitch to
argument
.Gets repr.
Subtracts
argument
from numbered pitch.Gets accidental of numbered pitch.
Gets arrow of numbered pitch.
Makes numbered pitch from
hertz
.Gets name of numbered pitch name according to
locale
.Gets frequency of numbered pitch in Hertz.
Interpolates between numbered pitch and
stop_pitch
byfraction
.Inverts numbered pitch around
axis
.Multiplies numbered pitch by index
n
.Gets name of numbered pitch.
Gets number of numbered pitch.
Gets octave of numbered pitch.
Gets pitch-class of numbered pitch.
Tranposes numbered pitch by
n
semitones.Special methods
- __add__(argument)[source]¶
Adds
argument
to numbered pitch.>>> abjad.NumberedPitch(12) + abjad.NumberedPitch(13) NumberedPitch(25)
>>> abjad.NumberedPitch(13) + abjad.NumberedPitch(12) NumberedPitch(25)
- Return type:
- overridden __eq__(argument)[source]¶
Is true when
argument
is a numbered pitch withnumber
the same as this numbered pitch.- Return type:
- overridden __le__(argument)[source]¶
Is true when
argument
can be coerced to a numbered pitch and when this numbered pitch is less or equal toargument
.>>> pitch_1 = abjad.NumberedPitch(12) >>> pitch_2 = abjad.NumberedPitch(12) >>> pitch_3 = abjad.NumberedPitch(13)
>>> pitch_1 <= pitch_1 True
>>> pitch_1 <= pitch_2 True
>>> pitch_1 <= pitch_3 True
>>> pitch_2 <= pitch_1 True
>>> pitch_2 <= pitch_2 True
>>> pitch_2 <= pitch_3 True
>>> pitch_3 <= pitch_1 False
>>> pitch_3 <= pitch_2 False
>>> pitch_3 <= pitch_3 True
- Return type:
- overridden __lt__(argument)[source]¶
Is true when
argument
can be coerced to a numbered pitch and when this numbered pitch is less thanargument
.>>> pitch_1 = abjad.NumberedPitch(12) >>> pitch_2 = abjad.NumberedPitch(12) >>> pitch_3 = abjad.NumberedPitch(13)
>>> pitch_1 < pitch_1 False
>>> pitch_1 < pitch_2 False
>>> pitch_1 < pitch_3 True
>>> pitch_2 < pitch_1 False
>>> pitch_2 < pitch_2 False
>>> pitch_2 < pitch_3 True
>>> pitch_3 < pitch_1 False
>>> pitch_3 < pitch_2 False
>>> pitch_3 < pitch_3 False
- Return type:
- __neg__()[source]¶
Negates numbered pitch.
>>> -abjad.NumberedPitch(13.5) NumberedPitch(-13.5)
>>> -abjad.NumberedPitch(-13.5) NumberedPitch(13.5)
- Return type:
- __radd__(argument)[source]¶
Adds numbered pitch to
argument
.>>> pitch = abjad.NumberedPitch(13) >>> abjad.NumberedPitch(12).__radd__(pitch) NumberedPitch(25)
>>> pitch = abjad.NumberedPitch(12) >>> abjad.NumberedPitch(13).__radd__(pitch) NumberedPitch(25)
- Return type:
- __sub__(argument)[source]¶
Subtracts
argument
from numbered pitch.>>> abjad.NumberedPitch(12) - abjad.NumberedPitch(12) NumberedInterval(0)
>>> abjad.NumberedPitch(12) - abjad.NumberedPitch(13) NumberedInterval(1)
>>> abjad.NumberedPitch(13) - abjad.NumberedPitch(12) NumberedInterval(-1)
- Return type:
Methods
- overridden get_name(locale=None)[source]¶
Gets name of numbered pitch name according to
locale
.>>> abjad.NumberedPitch(13).get_name() "cs''"
>>> abjad.NumberedPitch(13).get_name(locale="us") 'C#5'
Set
locale
to"us"
or none.- Return type:
- interpolate(stop_pitch, fraction)[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)
- Return type:
- overridden invert(axis=None)[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)
- Return type:
- overridden multiply(n=1)[source]¶
Multiplies numbered pitch by index
n
.>>> abjad.NumberedPitch(14).multiply(3) NumberedPitch(42)
- Return type:
- overridden transpose(n=0)[source]¶
Tranposes numbered pitch by
n
semitones.>>> abjad.NumberedPitch(13).transpose(1) NumberedPitch(14)
- Return type:
Class & static methods
- overridden classmethod from_hertz(hertz)[source]¶
Makes numbered pitch from
hertz
.>>> abjad.NumberedPitch.from_hertz(440) NumberedPitch(9)
REGRESSION. Returns 12 (not 0):
>>> abjad.NumberedPitch.from_hertz(519) NumberedPitch(12)
- Return type:
Read-only properties
- accidental¶
Gets accidental of numbered pitch.
>>> abjad.NumberedPitchClass(13).accidental Accidental(name='sharp')
- overridden arrow¶
Gets arrow of numbered pitch.
>>> 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>
Returns up, down or none.
- overridden hertz¶
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
- overridden name¶
Gets name of numbered pitch.
>>> abjad.NumberedPitch(13).name "cs''"
- overridden number¶
Gets number of numbered pitch.
>>> abjad.NumberedPitch(13).number 13
- overridden octave¶
Gets octave of numbered pitch.
>>> abjad.NumberedPitch(13).octave Octave(number=5)
- overridden pitch_class¶
Gets pitch-class of numbered pitch.
>>> abjad.NumberedPitch(13).pitch_class NumberedPitchClass(1)
- 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)
Attributes Summary
Adds
argument
to numbered pitch-class.Copies numbered pitch-class.
Compares
number
.Hashes numbered pitch-class.
Compares
number
.Negates numbered pitch-class.
Right-addition not defined on numbered pitch-classes.
Gets repr.
Subtracts
argument
from numbered pitch-class.Gets accidental.
Gets arrow of numbered pitch-class.
Inverts numbered pitch-class.
Multiplies pitch-class number by
n
.Gets name of numbered pitch-class.
Gets number.
Gets pitch-class / octave label.
Transposes numbered pitch-class by index
n
.Special methods
- __add__(argument)[source]¶
Adds
argument
to numbered pitch-class.>>> pitch_class = abjad.NumberedPitchClass(9)
>>> pitch_class + abjad.NumberedInterval(0) NumberedPitchClass(9)
>>> pitch_class + abjad.NumberedInterval(1) NumberedPitchClass(10)
>>> pitch_class + abjad.NumberedInterval(2) NumberedPitchClass(11)
>>> pitch_class + abjad.NumberedInterval(3) NumberedPitchClass(0)
- Return type:
- __copy__(*arguments)[source]¶
Copies numbered pitch-class.
>>> import copy >>> pitch_class = abjad.NumberedPitchClass(9) >>> copy.copy(pitch_class) NumberedPitchClass(9)
- Return type:
- overridden __eq__(argument)[source]¶
Compares
number
.>>> pitch_class_1 = abjad.NumberedPitchClass(0) >>> pitch_class_2 = abjad.NumberedPitchClass(0) >>> pitch_class_3 = abjad.NumberedPitchClass(1)
>>> pitch_class_1 == pitch_class_1 True
>>> pitch_class_1 == pitch_class_2 True
>>> pitch_class_1 == pitch_class_3 False
>>> pitch_class_2 == pitch_class_1 True
>>> pitch_class_2 == pitch_class_2 True
>>> pitch_class_2 == pitch_class_3 False
>>> pitch_class_3 == pitch_class_1 False
>>> pitch_class_3 == pitch_class_2 False
>>> pitch_class_3 == pitch_class_3 True
-
(
PitchClass
).__float__()¶ Coerce to float.
Returns float.
-
(
PitchClass
).__ge__(other)¶ Return a >= b. Computed by @total_ordering from (not a < b).
-
(
PitchClass
).__gt__(other)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
-
(
PitchClass
).__le__(other)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- overridden __lt__(argument)[source]¶
Compares
number
.>>> abjad.NumberedPitchClass(1) < abjad.NumberedPitchClass(2) True
>>> abjad.NumberedPitchClass(2) < abjad.NumberedPitchClass(1) False
- Return type:
- __neg__()[source]¶
Negates numbered pitch-class.
>>> pitch_class = abjad.NumberedPitchClass(9) >>> -pitch_class NumberedPitchClass(3)
- Return type:
- __radd__(argument)[source]¶
Right-addition not defined on numbered pitch-classes.
>>> 1 + abjad.NumberedPitchClass(9) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/trevor/abjad/abjad/pitch.py", line 4056, in __radd__ raise NotImplementedError(message) NotImplementedError: right-addition not defined on NumberedPitchClass.
Raises not implemented error.
- __sub__(argument)[source]¶
Subtracts
argument
from numbered pitch-class.Subtraction is defined against both numbered intervals and against other pitch-classes.
>>> abjad.NumberedPitchClass(6) - abjad.NumberedPitchClass(6) NumberedInversionEquivalentIntervalClass(0)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedPitchClass(7) NumberedInversionEquivalentIntervalClass(1)
>>> abjad.NumberedPitchClass(7) - abjad.NumberedPitchClass(6) NumberedInversionEquivalentIntervalClass(1)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedInterval(-1) NumberedPitchClass(5)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedInterval(0) NumberedPitchClass(6)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedInterval(1) NumberedPitchClass(5)
- Return type:
Union
[NumberedPitchClass
,NumberedInversionEquivalentIntervalClass
]
Methods
- overridden invert(axis=None)[source]¶
Inverts numbered pitch-class.
>>> 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)
Interprets axis of inversion equal to pitch-class 0.
- Return type:
- overridden multiply(n=1)[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)
- Return type:
- overridden transpose(n=0)[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)
- Return type:
Read-only properties
- overridden accidental¶
Gets accidental.
>>> abjad.NumberedPitchClass(1).accidental Accidental(name='sharp')
- arrow¶
Gets arrow of numbered pitch-class.
Returns up, down or none.
- name¶
Gets name of numbered pitch-class.
>>> abjad.NumberedPitchClass(13).name 'cs'
- number¶
Gets number.
>>> abjad.NumberedPitchClass(1).number 1
>>> abjad.NumberedPitchClass(13).number 1
- overridden pitch_class_label¶
Gets pitch-class / octave label.
>>> abjad.NumberedPitchClass(13).pitch_class_label 'C#'
- class abjad.pitch.Octave(number=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
Attributes Summary
Return self==value.
Get octave number as float.
Return self>=value.
Return self>value.
Return hash(self).
Get octave number integer.
Return self<=value.
Return self<value.
Return repr(self).
Makes octave from
pitch
.Makes octave from
ticks
string.Gets pitch number of first note in octave.
Gets LilyPond octave tick string.
Special methods
- overridden __eq__(other)¶
Return self==value.
- overridden __ge__(other)¶
Return self>=value.
- overridden __gt__(other)¶
Return self>value.
- overridden __hash__()¶
Return hash(self).
- overridden __le__(other)¶
Return self<=value.
- overridden __lt__(other)¶
Return self<value.
- overridden __repr__()¶
Return repr(self).
Class & static methods
- classmethod from_pitch(pitch)[source]¶
Makes octave from
pitch
.>>> abjad.Octave.from_pitch("cs") Octave(number=3)
>>> abjad.Octave.from_pitch("cs'") Octave(number=4)
>>> abjad.Octave.from_pitch(1) Octave(number=4)
>>> abjad.Octave.from_pitch(13) Octave(number=5)
- Return type:
- classmethod from_ticks(ticks)[source]¶
Makes octave from
ticks
string.>>> abjad.Octave.from_ticks("'") Octave(number=4)
>>> abjad.Octave.from_ticks(",,") Octave(number=1)
- Return type:
Read-only properties
- pitch_number¶
Gets pitch number of first note in octave.
>>> abjad.Octave(4).pitch_number 0
>>> abjad.Octave(5).pitch_number 12
>>> abjad.Octave(3).pitch_number -12
- ticks¶
Gets LilyPond octave tick string.
>>> for i in range(-1, 9): ... print(i, abjad.Octave(i).ticks) ... -1 ,,,, 0 ,,, 1 ,, 2 , 3 4 ' 5 '' 6 ''' 7 '''' 8 '''''
- class abjad.pitch.Pitch(argument, accidental=None, arrow=None, octave=None)[source]¶
Abstract pitch.
Attributes Summary
Coerce to float.
Return a >= b.
Return a > b.
Hashes pitch.
Return a <= b.
Is true when pitch is less than
argument
.Gets arrow of pitch.
Creates pitch from
hertz
.Gets name of pitch according to
locale
.Gets frequency of pitch in Hertz.
Inverts pitch about
axis
.Multiplies pitch by
n
.Gets name of pitch.
Gets number of pitch.
Gets octave of pitch.
Gets pitch-class of pitch.
Transposes pitch by index
n
.Special methods
- overridden __ge__(other)¶
Return a >= b. Computed by @total_ordering from (not a < b).
- overridden __gt__(other)¶
Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
- overridden __le__(other)¶
Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- overridden __lt__(argument)[source]¶
Is true when pitch is less than
argument
.Returns true or false.
Methods
- invert(axis=None)[source]¶
Inverts pitch about
axis
.Interprets
axis
of none equal to middle C.Returns new pitch.
Class & static methods
Read-only properties
- arrow¶
Gets arrow of pitch.
- hertz¶
Gets frequency of pitch in Hertz.
- name¶
Gets name of pitch.
Returns string.
- number¶
Gets number of pitch.
Returns number.
- octave¶
Gets octave of pitch.
Returns octave.
- pitch_class¶
Gets pitch-class of pitch.
Returns pitch-class.
- class abjad.pitch.PitchClass(argument)[source]¶
Abstract pitch-class.
Attributes Summary
Compares reprs.
Coerce to float.
Return a >= b.
Return a > b.
Hashes pitch-class.
Return a <= b.
Is true when pitch-class is less than
argument
.Gets accidental of pitch-class.
Inverts pitch-class about
axis
.Multiplies pitch-class by
n
.Gets pitch-class label of pitch-class.
Transposes pitch-class by index
n
.Special methods
- overridden __ge__(other)¶
Return a >= b. Computed by @total_ordering from (not a < b).
- overridden __gt__(other)¶
Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
- overridden __le__(other)¶
Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
- overridden __lt__(argument)[source]¶
Is true when pitch-class is less than
argument
.Returns true or false.
Methods
- class abjad.pitch.StaffPosition(number=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)
Attributes Summary
Implement delattr(self, name).
Return self==value.
Return self>=value.
Return self>value.
Return hash(self).
Return self<=value.
Return self<value.
Return repr(self).
Implement setattr(self, name, value).
Special methods
- overridden __delattr__(name)¶
Implement delattr(self, name).
- overridden __eq__(other)¶
Return self==value.
- overridden __ge__(other)¶
Return self>=value.
- overridden __gt__(other)¶
Return self>value.
- overridden __hash__()¶
Return hash(self).
- overridden __le__(other)¶
Return self<=value.
- overridden __lt__(other)¶
Return self<value.
- overridden __repr__()¶
Return repr(self).
- overridden __setattr__(name, value)¶
Implement setattr(self, name, value).