musicaiz.structure.NoteValue

class musicaiz.structure.NoteValue(pitch: Union[str, int])[source]

This class allows to instantiate a note object by just giving the pitch value or the name of the note in the MIDI format.

Raises
ValueError

if the input pitch value is out of the range 0-127 (MIDI format).

ValueError

if the input note name does not exists in the MIDI format.

Examples

>>> note_1 = musanalysis.NoteValue("C4")
>>> note_2 = musanalysis.NoteValue(120)
__init__(pitch: Union[str, int])[source]

Methods

__init__(pitch)

pitch_value_in_range(pitch_value)

split_note_name(note_name)

Splits a note name (C# or Cb...) into a note name (C) and the accidental (# or b ...)

split_pitch_name(pitch_name)

Splits a note name (C#1 or Cb-1...) into a note name (C or Cb ...) and the octave (1 or 1 ...)