pyabc2.Note¶
- class pyabc2.Note(value, duration=Fraction(1, 8))¶
A note has a pitch and a duration.
- Parameters:
Examples
>>> from pyabc2 import Note >>> from fractions import Fraction >>> Note(48) Note(value=48, name='C4', duration=1/8) >>> Note(48, Fraction('1/2')) Note(value=48, name='C4', duration=1/2)
>>> Note.from_abc('C') Note(value=48, name='C4', duration=1/8) >>> Note.from_abc('C4') # 4x unit duration Note(value=48, name='C4', duration=1/2)
>>> Note.from_abc('D,3', octave_base=3) Note(value=26, name='D2', duration=3/8)
>>> from pyabc2 import Pitch >>> p = Pitch.from_name('E#3') >>> Note.from_pitch(p) Note(value=41, name='E#3', duration=1/8) >>> Note(41) Note(value=41, name='F3', duration=1/8)
Methods
__init__(value[, duration])from_abc(abc, *[, key, octave_base, ...])Parse ABC string to note.
from_class_name(*args, **kwargs)not implemented
from_class_value(*args, **kwargs)not implemented
from_etf(*args, **kwargs)not implemented
from_helmholtz(*args, **kwargs)not implemented
from_name(*args, **kwargs)not implemented
from_pitch(p, *[, duration])From pitch instance.
from_pitch_class(*args, **kwargs)not implemented
to_abc(*[, key, octave_base, unit_duration])Convert to ABC notation string.
to_note()not implemented
to_pitch()Convert to pitch, preserving the class name.
to_pitch_class()Convert to pitch class, preserving the class name.
unicode()not implemented
Attributes
class_nameNote name (pitch class).
class_valueChromatic note value of the corresponding pitch class, relative to C.
equal_temperament_frequencyPiano key frequency.
etfAlias for
equal_temperament_frequency.helmholtzPitch name in Helmholtz pitch notation, e.g.
C,andc'(ASCII).nAlias for
piano_key_number.nameNote (pitch) name with octave, e.g., C4, Bb2.
octaveOctave number (e.g., A4/A440 is in octave 4).
piano_key_numberFor example, middle C (C4) is 40.
durationNote duration.
valuePitch value (integer chromatic distance from C0 in semitones (half steps)).