musicaiz.structure.Note

class musicaiz.structure.Note(pitch: Union[str, int], start: Union[int, float], end: Union[int, float], velocity: int, instrument_prog: Optional[int] = None, instrument_idx: Optional[int] = None, bar_idx: Optional[int] = None, beat_idx: Optional[int] = None, subbeat_idx: Optional[int] = None, ligated: bool = False, bpm: int = 120, resolution: int = 96, is_drum: bool = False)[source]

A note even with its relevant attributes.

Initializing:

  • Time: A note can be initialized in seconds with the note start note_on and

    note end note_off attributes or in ticks with start_ticks and duration_ticks.

    If note on, note off, start_icks and end_ticks are given, the object will be initialized with the note_on and note_off values ignoring the start_ticks and ènd_ticks` input values.

  • Pitch: A note can be initialized by giving the name of the pitch: C0…or by

    giving the pitch value: 12…

    If the pitch value is provided, the note name is ignored if it is also provided. This is done for preventing non valid pitch name and values pairs.

Params:

pitch: [description] note_on: [description] note_off: [description] velocity: [description] start_ticks: [description] duration_ticks: [description]

__init__(pitch: Union[str, int], start: Union[int, float], end: Union[int, float], velocity: int, instrument_prog: Optional[int] = None, instrument_idx: Optional[int] = None, bar_idx: Optional[int] = None, beat_idx: Optional[int] = None, subbeat_idx: Optional[int] = None, ligated: bool = False, bpm: int = 120, resolution: int = 96, is_drum: bool = False)[source]
Attributes
pitch: int
start: Union[str, int]

the note on. If the input argument is an int we consider that the value correspond to ticks unit, and if the argument is a float we assume the value corresponds to seconds.

end: Union[int, float]

the note off. If the input argument is an int we consider that the value correspond to ticks unit, and if the argument is a float we assume the value corresponds to seconds.

delta_time: int

the note duration in 16th notes.

bpm: int
the tempo or bpms.
resolution: int

the pulses o ticks per quarter note (PPQ or TPQN).

Raises:

ValueError: [description] ValueError: [description]

Methods

__init__(pitch, start, end, velocity[, ...])

Attributes

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

Attributes

note

pitch

pitch_name

note_name

octave

enharmonic

start_sec

end_sec

start_ticks

end_ticks

symbolic

velocity

bpm

resolution

ligated

instrument_prog

bar_idx

instrument_idx

is_drum