ms3 - Parsing MuseScore 3 and 4¶
Welcome to ms3, a Python library for parsing MuseScore files. It
parses MuseScore 3 and 4 files, i.e.
uncompressed
*.mscx
files,compressed
*.mscz
files,
extracts and processes the information contained in one or many scores in the form of DataFrames:
notes (start, duration, pitch etc.) and/or rests,
measures (time signature, lengths, repeat structure etc.)
labels, such as
guitar/Jazz chord labels
arbitrary annotation labels
expanded harmony labels following the DCML annotation standard
cadences (part of the same annotation syntax)
form_labels (annotation standard currently in press)
chords, that is, onset positions that have musical markup attached, e.g. dynamics, lyrics, slurs, 8va signs…
metadata from the respective fields, but also score statistics, such as length, number of notes, etc.
stores the extracted information in a uniform and interoperable tabular format (
*.tsv
)writes information from tabular
*.tsv
files into MuseScore files, especiallychord and annotation labels
metadata
header information (title, subtitle, etc.)
note coloring
uses a locally installed or standalone MuseScore executable for
batch-converting files to any output format supported by MuseScore (mscz, mscx, mp3, midi, pdf etc.)
on-the-fly converting any file that MuseScore can read (including MuseScore 2, cap, capx, midi, and musicxml) to parse it
offers its functionality via the convenient
ms3
commandline interface.
View the full documentation here.
For a demo video (using an old, pre-1.0.0 version) on YouTube, click here
Installation¶
ms3 requires Python >= 3.10 (type python3 --version
to check). Once you have switched to a virtual environment
that has Python 3.10 installed you can pip-install the library via one of the two commands:
python3 -m pip install ms3 pip install ms3
If successful, the installation will make the ms3
commands available in your PATH (try by typing ms3
).
Quick demo¶
Parsing a single score¶
import ms3
score = ms3.Score('musescore_file.mscz')
Parsing a corpus¶
import ms3
corpus = ms3.Corpus('score_directory')
corpus.parse()
Parsing several corpora¶
import ms3
corpora = ms3.Parse('my_research_corpora')
corpora.parse()
Acknowledgements¶
Development of this software tool was supported by the Swiss National Science Foundation within the project “Distant Listening – The Development of Harmony over Three Centuries (1700–2000)” (Grant no. 182811). This project is being conducted at the Latour Chair in Digital and Cognitive Musicology, generously funded by Mr. Claude Latour.
The Python package has been set up using PyScaffold 3.2.3.
Table of Contents¶
- Installation
- Quick Reference
- Manual
- Developers' Reference
- The Parse class
- The Corpus class
- The Piece class
- The View class
- The Score class
- The Annotations class
- The BeautifulSoup parser
- The expand_dcml module
- Utils
COMPUTED_METADATA_COLUMNS
DCML_METADATA_COLUMNS
MUSESCORE_METADATA_FIELDS
VERSION_COLUMNS
MUSESCORE_HEADER_FIELDS
AUTOMATIC_COLUMNS
METADATA_COLUMN_ORDER
STANDARD_NAMES
DCML_REGEX
DCML_DOUBLE_REGEX
FORM_DETECTION_REGEX
rgba
map_dict
assert_all_lines_equal()
assert_dfs_equal()
ambitus2oneliner()
changes2list()
changes2tpc()
check_labels()
color2rgba()
color_name2format()
color_name2html()
color_name2rgb()
color_name2rgba()
color_params2rgba()
commonprefix()
compute_mn()
compute_mn_playthrough()
convert_folder()
decode_harmonies()
df2md()
dict2oneliner()
resolve_form_abbreviations()
distribute_tokens_over_levels()
expand_single_form_label()
expand_form_labels()
fifths2acc()
fifths2iv()
tpc2name()
fifths2name()
fifths2pc()
fifths2rn()
fifths2sd()
get_musescore()
get_path_component()
group_id_tuples()
html2format()
html_color2format()
html_color2name()
html_color2rgb()
html_color2rgba()
interval_overlap()
interval_overlap_size()
is_any_row_equal()
is_minor_mode()
iter_nested()
iter_selection()
first_level_subdirs()
first_level_files_and_subdirs()
get_first_level_corpora()
join_tsvs()
parse_interval_index_column()
load_tsv()
make_csvw_jsonld()
make_continuous_offset_series()
make_offset_dict_from_measures()
make_id_tuples()
make_interval_index_from_breaks()
make_name_columns()
make_playthrough2mc()
make_playthrough_info()
map2elements()
merge_ties()
metadata2series()
midi2octave()
mn2int()
name2format()
name2fifths()
name2pc()
nan_eq()
next2sequence()
no_collections_no_booleans()
parts_info()
path2type()
pretty_dict()
resolve_dir()
rgb2format()
rgb_tuple2format()
rgb_tuple2html()
rgb_tuple2name()
roman_numeral2fifths()
roman_numeral2semitones()
scale_degree2name()
scan_directory()
column_order()
sort_note_list()
sort_tpcs()
split_alternatives()
split_note_name()
split_scale_degree()
transform()
adjacency_groups()
unfold_measures_table()
unfold_repeats()
capture_parse_logs()
write_metadata()
enforce_fname_index_for_metadata()
write_markdown()
write_tsv()
abs2rel_key()
rel2abs_key()
make_interval_index_from_durations()
replace_index_by_intervals()
boolean_mode_col2strings()
replace_boolean_mode_by_strings()
resolve_relative_keys()
series_is_minor()
str_is_minor()
transpose_changes()
features2tpcs()
path2parent_corpus()
chord2tpcs()
transpose()
ignored_warnings2dict()
parse_ignored_warnings_file()
overlapping_chunk_per_interval()
infer_tsv_type()
reduce_dataframe_duration_to_first_row()
File
ask_user_to_choose()
disambiguate_files()
files2disambiguation_dict()
literal_type2tuple()
argument_and_literal_type2list()
resolve_facets_param()
unpack_json_paths()
compute_path_from_file()
make_file_path()
string2identifier()
parse_tsv_file_at_git_revision()
- Transformations
make_note_name_and_octave_columns()
add_quarterbeats_col()
add_weighted_grace_durations()
compute_chord_tones()
dfs2quarterbeats()
get_chord_sequences()
group_annotations_by_features()
labels2global_tonic()
make_gantt_data()
notes2pcvs()
resolve_all_relative_numerals()
segment_by_adjacency_groups()
segment_by_criterion()
segment_by_interval_index()
slice_df()
transform_multiple()
transform_annotations()
transpose_notes_to_localkey()
transform_columns()
transform_note_columns()
transpose_chord_tones_by_localkey()
- The commandline interface
- Developing a new parser
- License
- Authors
- Changelog
- Version 1.1.2
- Version 1.1.1
- Version 1.1.0
- Version 1.0.4
- Version 1.0.3
- Version 1.0.2
- Version 1.0.1
- Version 1.0.0
- Version 0.5.3
- Version 0.5.2
- Version 0.5.1
- Version 0.5.0
- Version 0.4.10
- Version 0.4.9
- Version 0.4.8
- Version 0.4.7
- Version 0.4.6
- Version 0.4.5
- Version 0.4.3
- Version 0.4.2
- Version 0.4.1
- Version 0.4.0
- Version 0.3.0
- Version 0.2.0
- Version 0.1.3
- Version 0.1.0