NumberedPitch¶

class
pitchtools.
NumberedPitch
(pitch_number=None)¶ Numbered pitch.
Lineage¶
Bases¶
abjad.tools.pitchtools.Pitch
abjad.tools.abctools.AbjadValueObject
abjad.tools.abctools.AbjadObject
abjad.tools.abctools.AbjadObject.AbstractBase
builtins.object
Attribute summary¶
accidental 
Gets accidental of numbered pitch. 
alteration_in_semitones 
Gets alteration of numbered pitch in semitones. 
apply_accidental ([accidental]) 
Applies accidental to numbered pitch. 
diatonic_pitch_class_name 
Gets diatonic pitchclass name corresponding to numbered pitch. 
diatonic_pitch_class_number 
Gets diatonic pitchclass number of numbered pitch. 
diatonic_pitch_name 
Gets diatonic pitch name of numbered pitch. 
diatonic_pitch_number 
Gets diatonic pitchclass number corresponding to numbered pitch. 
from_hertz (class_, hertz) 
Creates pitch from hertz. 
from_pitch_class_octave (pitch_class, octave) 
Initializes numbered pitch from pitch_class and octave. 
hertz 
Gets frequency of pitch in Herz. 
interpolate (stop_pitch, fraction) 
Interpolates between this pitch and stop_pitch by fraction amount. 
invert ([axis]) 
Inverts numberd pitch around axis. 
is_diatonic_pitch_name (argument) 
Is true when argument is a diatonic pitch name. 
is_diatonic_pitch_number (argument) 
Is true when argument is a diatonic pitch number. 
is_pitch_carrier (argument) 
Is true when argument is an Abjad pitch, note, notehead of chord instance. 
is_pitch_class_octave_number_string (argument) 
Is true when argument is a pitchclass / octave number string. 
is_pitch_name (argument) 
Is true when argument is a pitch name. 
is_pitch_number (argument) 
Is true when argument is a pitch number. 
multiply ([n]) 
Multiplies pitch by index n. 
name 
Gets pitch name. 
named_pitch 
Gets named pitch corresponding to numbered pitch. 
named_pitch_class 
Gets named pitchclass corresponding to numbered pitch. 
number 
Gets pitch number. 
numbered_pitch 
Gets numbered pitch. 
numbered_pitch_class 
Gets numbered pitchclass corresponding to numbered pitch. 
octave 
Gets octave of numbered pitch. 
pitch_class 
Gets pitchclass. 
pitch_class_name 
Gets pitchclass name of numbered pitch. 
pitch_class_number 
Gets pitchclass number of numbered pitch. 
pitch_class_octave_label 
Gets pitchclass / octave label of numbered pitch. 
pitch_name 
Gets pitch name corresponding to numbered pitch. 
pitch_number 
Gets pitch number of numbered pitch. 
transpose ([n]) 
Tranposes numbered pitch by n semitones. 
__add__ (argument) 
Adds argument to numberd pitch. 
__copy__ (*arguments) 
Copies Abjad value object. 
__eq__ (argument) 
Is true when all initialization values of Abjad value object equal the initialization values of argument. 
__float__ () 
Changes numbered pitch to float. 
__format__ ([format_specification]) 
Formats pitch. 
__ge__ (other[, NotImplemented]) 
Return a >= b. 
__gt__ (other[, NotImplemented]) 
Return a > b. 
__hash__ () 
Hashes Abjad value object. 
__illustrate__ () 
Illustrates pitch. 
__int__ () 
Changes numbered pitch to integer. 
__le__ (other[, NotImplemented]) 
Return a <= b. 
__lt__ (argument) 
Is true when argument can be coerced to a numbered pitch and when this numbered pitch is less than argument. 
__ne__ (argument) 
Is true when Abjad object does not equal argument. 
__neg__ () 
Negates numbered pitch. 
__repr__ () 
Gets interpreter representation of Abjad object. 
__str__ () 
String representation of numbered pitch. 
__sub__ (argument) 
Subtracts argument from numbered pitch. 
Readonly properties¶

NumberedPitch.
accidental
¶ Gets accidental of numbered pitch.
>>> NumberedPitchClass(13).accidental Accidental('s')
Returns accidental.

NumberedPitch.
alteration_in_semitones
¶ Gets alteration of numbered pitch in semitones.
>>> NumberedPitchClass(13).alteration_in_semitones 1
Returns integer or float.

NumberedPitch.
diatonic_pitch_class_name
¶ Gets diatonic pitchclass name corresponding to numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).diatonic_pitch_class_name 'c'
Returns string.

NumberedPitch.
diatonic_pitch_class_number
¶ Gets diatonic pitchclass number of numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).diatonic_pitch_class_number 0
Returns integer.

NumberedPitch.
diatonic_pitch_name
¶ Gets diatonic pitch name of numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).diatonic_pitch_name "c''"
Returns string.

NumberedPitch.
diatonic_pitch_number
¶ Gets diatonic pitchclass number corresponding to numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).diatonic_pitch_number 7
Returns integer.

NumberedPitch.
name
¶ Gets pitch name.
>>> NumberedPitch(13).name "cs''"
Returns string

NumberedPitch.
named_pitch
¶ Gets named pitch corresponding to numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).named_pitch NamedPitch("cs''")
Returns named pitch.

NumberedPitch.
named_pitch_class
¶ Gets named pitchclass corresponding to numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).named_pitch_class NamedPitchClass('cs')
Returns named pitchclass.

NumberedPitch.
number
¶ Gets pitch number.
>>> NumberedPitch(13).number 13
Returns number.

NumberedPitch.
numbered_pitch
¶ Gets numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).numbered_pitch NumberedPitch(13)
Returns new numbered pitch.

NumberedPitch.
numbered_pitch_class
¶ Gets numbered pitchclass corresponding to numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).numbered_pitch_class NumberedPitchClass(1)
Returns numbered pitchclass.

NumberedPitch.
octave
¶ Gets octave of numbered pitch.
>>> NumberedPitch(13).octave Octave(5)
Returns octave.

NumberedPitch.
pitch_class
¶ Gets pitchclass.
>>> NumberedPitch(13).pitch_class NumberedPitchClass(1)
Returns numbered pitchclass.

NumberedPitch.
pitch_class_name
¶ Gets pitchclass name of numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).pitch_class_name 'cs'
Returns string.

NumberedPitch.
pitch_class_number
¶ Gets pitchclass number of numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).pitch_class_number 1
Returns integer or float.

NumberedPitch.
pitch_class_octave_label
¶ Gets pitchclass / octave label of numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).pitch_class_octave_label 'C#5'
Returns string.

NumberedPitch.
pitch_name
¶ Gets pitch name corresponding to numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).pitch_name "cs''"
Returns string.

NumberedPitch.
pitch_number
¶ Gets pitch number of numbered pitch.
Note
Deprecated.
>>> NumberedPitch(13).pitch_number 13
Returns number.
Methods¶

NumberedPitch.
apply_accidental
(accidental=None)¶ Applies accidental to numbered pitch.
>>> NumberedPitch(13).apply_accidental('flat') NumberedPitch(12)
Returns new numbered pitch.

NumberedPitch.
interpolate
(stop_pitch, fraction)¶ Interpolates between this pitch and stop_pitch by fraction amount.
Interpolates up from C4 to C5:
>>> start_pitch = NumberedPitch(0) >>> stop_pitch = NumberedPitch(12)
>>> start_pitch.interpolate(stop_pitch, Fraction(0)) NumberedPitch(0)
>>> start_pitch.interpolate(stop_pitch, Fraction(1, 4)) NumberedPitch(3)
>>> start_pitch.interpolate(stop_pitch, Fraction(1, 2)) NumberedPitch(6)
>>> start_pitch.interpolate(stop_pitch, Fraction(3, 4)) NumberedPitch(9)
>>> start_pitch.interpolate(stop_pitch, Fraction(1)) NumberedPitch(12)
Interpolates down from C5 to C4:
>>> start_pitch = NumberedPitch(12) >>> stop_pitch = NumberedPitch(0)
>>> start_pitch.interpolate(stop_pitch, Fraction(0)) NumberedPitch(12)
>>> start_pitch.interpolate(stop_pitch, Fraction(1, 4)) NumberedPitch(9)
>>> start_pitch.interpolate(stop_pitch, Fraction(1, 2)) NumberedPitch(6)
>>> start_pitch.interpolate(stop_pitch, Fraction(3, 4)) NumberedPitch(3)
>>> start_pitch.interpolate(stop_pitch, Fraction(1)) NumberedPitch(0)
Returns new pitch.

NumberedPitch.
invert
(axis=None)¶ Inverts numberd pitch around axis.
Inverts pitchclass about pitchclass 0 explicitly:
>>> NumberedPitch(2).invert(0) NumberedPitch(2)
>>> NumberedPitch(2).invert(0) NumberedPitch(2)
Inverts pitchclass about pitchclass 0 implicitly:
>>> NumberedPitch(2).invert() NumberedPitch(2)
>>> NumberedPitch(2).invert() NumberedPitch(2)
Inverts pitchclass about pitchclass 3:
>>> NumberedPitch(2).invert(3) NumberedPitch(8)
Returns new numbered pitch.

NumberedPitch.
multiply
(n=1)¶ Multiplies pitch by index n.
>>> NumberedPitch(14).multiply(3) NumberedPitch(42)
Returns new numbered pitch.

NumberedPitch.
transpose
(n=0)¶ Tranposes numbered pitch by n semitones.
>>> NumberedPitch(13).transpose(1) NumberedPitch(14)
Returns new numbered pitch.
Class & static methods¶

static
NumberedPitch.
from_pitch_class_octave
(pitch_class, octave)¶ Initializes numbered pitch from pitch_class and octave.
>>> for octave in [1, 2, 3, 4, 5, 6, 7]: ... NumberedPitch.from_pitch_class_octave(6, octave) ... NumberedPitch(30) NumberedPitch(18) NumberedPitch(6) NumberedPitch(6) NumberedPitch(18) NumberedPitch(30) NumberedPitch(42)
Returns new numbered pitch.

(
Pitch
).is_diatonic_pitch_name
(argument)¶ Is true when argument is a diatonic pitch name. Otherwise false.
>>> pitchtools.Pitch.is_diatonic_pitch_name("c''") True
>>> pitchtools.Pitch.is_diatonic_pitch_name("cs''") False
The regex
(^[ag,AG])(,+'+)$
underlies this predicate.Returns true or false.

(
Pitch
).is_diatonic_pitch_number
(argument)¶ Is true when argument is a diatonic pitch number. Otherwise false.
>>> pitchtools.Pitch.is_diatonic_pitch_number(7) True
>>> pitchtools.Pitch.is_diatonic_pitch_number(7.5) False
Diatonic pitch numbers are equal to the set of integers.
Returns true or false.

(
Pitch
).is_pitch_class_octave_number_string
(argument)¶ Is true when argument is a pitchclass / octave number string. Otherwise false.
>>> pitchtools.Pitch.is_pitch_class_octave_number_string('C#2') True
Supports quartertone accidentals:
>>> pitchtools.Pitch.is_pitch_class_octave_number_string('C#2') True
>>> pitchtools.Pitch.is_pitch_class_octave_number_string('C#') False
The regex
^([AG])([#]{1,2}[b]{1,2}[#]?[+][b]?[~])([]?[09]+)$
underlies this predicate.Returns true or false.

(
Pitch
).is_pitch_number
(argument)¶ Is true when argument is a pitch number. Otherwise false.
>>> pitchtools.Pitch.is_pitch_number(13) True
>>> pitchtools.Pitch.is_pitch_number('text') False
Pitch numbers are equal to the set of all integers in union with the set of all integers plus of minus 0.5.
Returns true or false.
Special methods¶

NumberedPitch.
__add__
(argument)¶ Adds argument to numberd pitch.
Returns new numbered pitch.

(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.

(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of argument.
Returns true or false.

NumberedPitch.
__float__
()¶ Changes numbered pitch to float.
Returns float.

NumberedPitch.
__ge__
(other, NotImplemented=NotImplemented)¶ Return a >= b. Computed by @total_ordering from (not a < b).

NumberedPitch.
__gt__
(other, NotImplemented=NotImplemented)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).

(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.

NumberedPitch.
__int__
()¶ Changes numbered pitch to integer.
Returns integer.

NumberedPitch.
__le__
(other, NotImplemented=NotImplemented)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).

NumberedPitch.
__lt__
(argument)¶ Is true when argument can be coerced to a numbered pitch and when this numbered pitch is less than argument. Otherwise false.
Returns true or false.

(
AbjadObject
).__ne__
(argument)¶ Is true when Abjad object does not equal argument. Otherwise false.
Returns true or false.

NumberedPitch.
__neg__
()¶ Negates numbered pitch.
Returns new numbered pitch.

(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.

NumberedPitch.
__str__
()¶ String representation of numbered pitch.
Returns string.

NumberedPitch.
__sub__
(argument)¶ Subtracts argument from numbered pitch.
Returns numbered interval.