10.1.13.3. Pitch¶
Classes for representing and manipulating pitches, pitch-space, and accidentals.
-
class
Musica.Theory.Pitch.
Accidental
(accidental_value)[source]¶ Bases:
object
Accidental class, representing the symbolic and numerical representation of pitch deviation from a pitch name (e.g. C).
-
classmethod
parse_accidental
(value)[source]¶ Return an alteration from a
Alteration
instance, an alteration name or a modifier string.
-
__alteration_to_name__
= {0: 'natural', 1: 'sharp', 2: 'double-sharp', 3: 'triple-sharp', 4: 'quadruple-sharp', -1: 'flat', -2: 'double-flat', -3: 'triple-flat', -4: 'quadruple-flat', 0.5: 'half-flat', 1.5: 'one-and-a-half-sharp', -1.5: 'one-and-a-half-flat'}¶
-
__hash__
= None¶
-
__modifier_regexp__
= re.compile('[#-]*')¶
-
__name_to_alteration__
= {'natural': 0, 'sharp': 1, 'double-sharp': 2, 'triple-sharp': 3, 'quadruple-sharp': 4, 'flat': -1, 'double-flat': -2, 'triple-flat': -3, 'quadruple-flat': -4, 'half-sharp': 0.5, 'one-and-a-half-sharp': 1.5, 'half-flat': 0.5, 'one-and-a-half-flat': -1.5}¶
-
__name_to_modifier__
= {'natural': '', 'sharp': '#', 'double-sharp': '##', 'triple-sharp': '###', 'quadruple-sharp': '####', 'flat': '-', 'double-flat': '--', 'triple-flat': '---', 'quadruple-flat': '----', 'half-sharp': '~', 'one-and-a-half-sharp': '#~', 'half-flat': '`', 'one-and-a-half-flat': '-`'}¶
-
alteration
¶
-
is_flat
¶
-
is_normal
¶
-
is_sharp
¶
-
modifier
¶
-
name
¶
-
unicode_name
¶
-
classmethod
-
class
Musica.Theory.Pitch.
Pitch
(name=None, **kwargs)[source]¶ Bases:
object
Class to represents a pitch.
-
__hash__
= None¶
-
__implicit_octave__
= 4¶
-
__pitch_regexp__
= re.compile('(?P<note>[abcdefg])(?P<accidental>[#-]*)(?P<octave_sign>(/-)?)(?P<octave>\\d*)')¶
-
__temperament__
= <Musica.Theory.Temperament.UsualEqualTemperament object>¶
-
accidental
¶
-
alteration
¶
-
degree
¶
-
english_locale
¶
-
french_locale
¶
-
frequency
¶
-
full_name
¶
-
implicit_octave
¶
-
is_altered
¶
-
latin_unicode_name
¶
-
latin_unicode_name_with_octave
¶
-
locale
¶
-
midi
¶ Return the closest midi code.
The MIDI specification only defines note number 60 as “Middle C” (C4, Do3), and all other notes are relative. Note are encoded by a 7-bit non signed integer, ranging from 0 to 127. Consequently, Midi map note C/-1 to 0, C#0 to 1, … and G9 to 127.
-
midi_float
¶
-
name
¶
-
natural_locale
¶
-
octave
¶
-
pitch_class
¶ Returns the integer value for the pitch, between 0 and 11, where C=0, C#=1, D=2, … B=11.
-
spelling_is_inferred
¶
-
step
¶ The diatonic name of the note; i.e. it does not give the accidental and octave.
-
step_number
¶
-
temperament
¶
-
unicode_name
¶
-
unicode_name_with_octave
¶
-