musicaiz.loaders.Musa

class musicaiz.loaders.Musa(file: Optional[Union[str, TextIO, pathlib.Path]], quantize: bool = False, cut_notes: bool = False, tonality: Optional[str] = None, resolution: Optional[int] = None, absolute_timing: bool = True, general_midi: bool = False, subdivision_note: str = 'sixteenth', quantizer_args: Type[musicaiz.rhythm.quantizer.QuantizerConfig] = <class 'musicaiz.rhythm.quantizer.QuantizerConfig'>)[source]
__init__(file: Optional[Union[str, TextIO, pathlib.Path]], quantize: bool = False, cut_notes: bool = False, tonality: Optional[str] = None, resolution: Optional[int] = None, absolute_timing: bool = True, general_midi: bool = False, subdivision_note: str = 'sixteenth', quantizer_args: Type[musicaiz.rhythm.quantizer.QuantizerConfig] = <class 'musicaiz.rhythm.quantizer.QuantizerConfig'>)[source]

Structure: attributes that contains lists of Note and Instrument objects. Time: attributes that contains lists of Bar, Beat and Subdivision objects.

A MIDI file can contain time signature changes, so each Beat objects are equivalent to the Bar they belong to. Ex.: a 2/4 time signature will contain 2 beats = 2 quarter notes whereas a 3/8 bar will contain 3 beats = 3 eight notes.

Methods

__init__(file[, quantize, cut_notes, ...])

Structure: attributes that contains lists of Note and Instrument objects.

bar_beats_subdivs_analysis()

get_beat_in_bar(beat_idx, bar_idx)

get_beats_in_bar(bar_idx)

get_beats_in_bars(bar_start, bar_end)

get_file_extension(file)

get_notes_in_bar(bar_idx[, program, ...])

get_notes_in_bars(bar_start, bar_end[, ...])

get_notes_in_beat(beat_idx[, program, ...])

beat_idx is the global index of the beat in the file.

get_notes_in_beat_bar(beat_idx, bar_idx[, ...])

beat_idx is the local index of the beat in the file.

get_notes_in_beats(beat_start, beat_end[, ...])

get_notes_in_subbeat(subbeat_idx[, program, ...])

get_notes_in_subbeat_bar(subbeat_idx, bar_idx)

get_notes_in_subbeats(subbeat_start, subbeat_end)

get_subbeat_in_bar(subbeat_idx, bar_idx)

get_subbeat_in_beat(subbeat_idx, beat_idx)

get_subbeats_in_bar(bar_idx)

get_subbeats_in_bars(bar_start, bar_end)

get_subbeats_in_beat(beat_idx)

get_subbeats_in_beats(beat_start, beat_end)

is_midi(file)

is_musicxml(file)

is_valid(file)

json()

predict_key(method)

Predict the key with the key profiles algorithms.

writemidi(filename)

Attributes

file

tonality

time_signature_changes

resolution

instruments

is_quantized

total_bars

absolute_timing

cut_notes

notes

bars

tempo_changes

instruments_progs

general_midi

subdivision_note

subbeats

beats

quantizer_args

VALID_SUBDIVISIONS