musicaiz.tokenizers.MMMTokenizer¶
- class musicaiz.tokenizers.MMMTokenizer(file: Optional[Union[str, TextIO, pathlib.Path]] = None, args: Optional[musicaiz.tokenizers.mmm.MMMTokenizerArguments] = None)[source]¶
This class presents methods to compute the Multi-Track Music Machine Encoding.
- Attributes
- file: Optional[Union[str, TextIO, Path]] = None
- __init__(file: Optional[Union[str, TextIO, pathlib.Path]] = None, args: Optional[musicaiz.tokenizers.mmm.MMMTokenizerArguments] = None)[source]¶
Methods
__init__
([file, args])add_token_to_vocabulary
()get_pieces_tokens
(tokens)get_tokens_analytics
(tokens)get_vocabulary
([vocab_filename])This method gets the vocabulary of a tokenize dataset in all the token-sequences.txt files in the directory dataset_path.
split_tokens_by_bar
(instr_tokens)Split tokens list by bars
split_tokens_by_track
(piece_tokens)Split tokens list by instrument
to_txt
(all_files_tokens, file_name, path)tokenize_file
()This method tokenizes a Musa (MIDI) object.
tokenize_track_bars
(bars, program[, tokens])This method tokenizes a given list of musicaiz bar objects.
tokenize_tracks
(instruments, bar_start[, ...])This method tokenizes a Musa (MIDI) object.
tokens_to_musa
(tokens[, absolute_timing, ...])