Pitch

abstract class pitchtools.Pitch

Pitch base class.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.NamedPitch.NamedPitch" [color=3, group=2, label=NamedPitch, shape=box]; "abjad.tools.pitchtools.NumberedPitch.NumberedPitch" [color=3, group=2, label=NumberedPitch, shape=box]; "abjad.tools.pitchtools.Pitch.Pitch" [color=black, fontcolor=white, group=2, label=<<B>Pitch</B>>, shape=oval, style="filled, rounded"]; "abjad.tools.pitchtools.Pitch.Pitch" -> "abjad.tools.pitchtools.NamedPitch.NamedPitch"; "abjad.tools.pitchtools.Pitch.Pitch" -> "abjad.tools.pitchtools.NumberedPitch.NumberedPitch"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.pitchtools.Pitch.Pitch"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

alteration_in_semitones Gets alteration of pitch in semitones.
apply_accidental([accidental]) Applies accidental to pitch.
diatonic_pitch_class_name Gets diatonic pitch-class name of pitch.
diatonic_pitch_class_number Gets diatonic pitch-class number of pitch.
diatonic_pitch_name Gets diatonic pitch name of pitch.
diatonic_pitch_number Gets diatonic pitch number of pitch.
from_hertz(class_, hertz) Creates pitch from hertz.
hertz Gets frequency of pitch in Herz.
invert([axis]) Inverts pitch about 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, note-head of chord instance.
is_pitch_class_octave_number_string(argument) Is true when argument is a pitch-class / 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 n.
name Gets pitch name.
named_pitch Gets named pitch corresponding to pitch.
named_pitch_class Gets named pitch-class corresponding to pitch.
number Gets pitch number.
numbered_pitch Gets numbered pitch corresponding to pitch.
numbered_pitch_class Gets numbered pitch-class corresponding to pitch.
octave Gets octave of pitch.
pitch_class Gets pitch-class.
pitch_class_name Gets pitch-class name corresponding to pitch.
pitch_class_number Gets pitch-class number of pitch.
pitch_class_octave_label Gets pitch-class / octave label of pitch.
pitch_name Gets pitch name of pitch.
pitch_number Get pitch number of pitch.
transpose(n) Transposes pitch by index n.
__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 pitch to float.
__format__([format_specification]) Formats pitch.
__hash__() Hashes Abjad value object.
__illustrate__() Illustrates pitch.
__int__() Changes pitch to integer.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

abstract Pitch.alteration_in_semitones

Gets alteration of pitch in semitones.

abstract Pitch.diatonic_pitch_class_name

Gets diatonic pitch-class name of pitch.

Note

Deprecated.

abstract Pitch.diatonic_pitch_class_number

Gets diatonic pitch-class number of pitch.

Note

Deprecated.

abstract Pitch.diatonic_pitch_name

Gets diatonic pitch name of pitch.

Note

Deprecated.

abstract Pitch.diatonic_pitch_number

Gets diatonic pitch number of pitch.

Note

Deprecated.

Pitch.hertz

Gets frequency of pitch in Herz.

>>> pitchtools.NamedPitch("a'").hertz
440.0
>>> pitchtools.NamedPitch("c'").hertz
261.62...
>>> pitchtools.NamedPitch("c''").hertz
523.25...

Returns float.

abstract Pitch.name

Gets pitch name.

abstract Pitch.named_pitch

Gets named pitch corresponding to pitch.

Note

Deprecated.

abstract Pitch.named_pitch_class

Gets named pitch-class corresponding to pitch.

Note

Deprecated.

abstract Pitch.number

Gets pitch number.

abstract Pitch.numbered_pitch

Gets numbered pitch corresponding to pitch.

Note

Deprecated.

abstract Pitch.numbered_pitch_class

Gets numbered pitch-class corresponding to pitch.

Note

Deprecated.

abstract Pitch.octave

Gets octave of pitch.

Returns octave.

abstract Pitch.pitch_class

Gets pitch-class.

Returns pitch-class.

abstract Pitch.pitch_class_name

Gets pitch-class name corresponding to pitch.

Note

Deprecated.

abstract Pitch.pitch_class_number

Gets pitch-class number of pitch.

Note

Deprecated.

abstract Pitch.pitch_class_octave_label

Gets pitch-class / octave label of pitch.

Note

Deprecated.

abstract Pitch.pitch_name

Gets pitch name of pitch.

Note

Deprecated.

abstract Pitch.pitch_number

Get pitch number of pitch.

Note

Deprecated.

Methods

abstract Pitch.apply_accidental(accidental=None)

Applies accidental to pitch.

Returns new pitch.

abstract Pitch.invert(axis=None)

Inverts pitch about axis.

Interprets axis of none equal to middle C.

Returns new pitch.

abstract Pitch.multiply(n=1)

Multiplies pitch by n.

abstract Pitch.transpose(n)

Transposes pitch by index n.

Returns new pitch.

Class & static methods

classmethod Pitch.from_hertz(class_, hertz)

Creates pitch from hertz.

>>> pitchtools.NamedPitch.from_hertz(440)
NamedPitch("a'")
>>> pitchtools.NumberedPitch.from_hertz(440)
NumberedPitch(9)
>>> pitchtools.NamedPitch.from_hertz(519)
NamedPitch("c'")

Returns new pitch.

static 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 (^[a-g,A-G])(,+|'+|)$ underlies this predicate.

Returns true or false.

static 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.

static Pitch.is_pitch_carrier(argument)

Is true when argument is an Abjad pitch, note, note-head of chord instance. Otherwise false.

>>> note = Note("c'4")
>>> pitchtools.Pitch.is_pitch_carrier(note)
True
>>> pitchtools.Pitch.is_pitch_carrier('text')
False

Returns true or false.

static Pitch.is_pitch_class_octave_number_string(argument)

Is true when argument is a pitch-class / 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 ^([A-G])([#]{1,2}|[b]{1,2}|[#]?[+]|[b]?[~]|)([-]?[0-9]+)$ underlies this predicate.

Returns true or false.

static Pitch.is_pitch_name(argument)

Is true when argument is a pitch name. Otherwise false.

>>> pitchtools.Pitch.is_pitch_name('c,')
True
>>> pitchtools.Pitch.is_pitch_name('z')
False

The regex ^([a-g,A-G])(([s]{1,2}|[f]{1,2}|t?q?[f,s]|)!?)(,+|'+|)$ underlies this predicate.

Returns true or false.

static 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

(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.

abstract Pitch.__float__()

Changes pitch to float.

Returns float.

Pitch.__format__(format_specification='')

Formats pitch.

Set format_specification to ‘’, ‘lilypond’ or ‘storage’.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

Pitch.__illustrate__()

Illustrates pitch.

Returns LilyPond file.

abstract Pitch.__int__()

Changes pitch to integer.

Returns integer.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.