Note class¶
-
class
Note(*args, note_str=None, note=None, octave=None, midi=None)¶ Can be created using keywords or implicitly. 1 string argument is mapped to
note_str, 1 str and 1 int arguments are mapped tonoteandoctave, 1 int argument is mapped tomidi.Parameters: - *args – When no keywords are specified, attempts to implicitly map to another parameter or parameters.
- note_str (str) – The ASCII representation of a note ordered as [note letter][optional accidental][octave number], for example A4, C#2. Also accepts lower case, and normally unusual accidentals, for example fb4 would create a note E4.
- note (str) – The note letter, or more formally the alphabetical representation of the pitch class. Accidentals are allowed. Can’t be used with
note_str, but requires thatoctavebe specified. - octave (int) – The octave of the note. Can’t be used with
note_str, but requires thatnotebe specified.
Raises: - TypeError – When
note_stris called with eithernoteoroctave. - TypeError – When implicit variable mapping fails, or when not enough or too many variables are given.
-
note¶
The note letter, e.g. ‘A’ or ‘F#’.
-
pc¶
Pitch class, see https://en.wikipedia.org/wiki/Pitch_class#Integer_notation.
-
octave¶
Octave number for the note.
-
midi¶
MIDI note number.
-
freq¶
Frequency of the note in Hz.
-
pitch_class_map¶
dictClass attribute that maps pitch classes (pc) tonote.-
pitch_class_map_complement¶
dictClass attribute, the inverse ofpitch_class_map.-
classmethod
_note_octave_to_midi(note, octave)¶
Used to get the
midivalue for a givennoteandoctave.-
classmethod
_midi_to_note_octave(m)¶
Takes a MIDI number
mand returns anoteandoctave.