Python implementation of the MeasureMap specification
Clone the repository
Install the package:
If you only want to use the package, install it with pip:
pip install .
(where . stands for the directory with your local clone)
If you want to run the tests:
pip install ".[testing]"
If you want to contribute, make sure to include -e (for editable) and run:
pip install -e ".[dev]"
To run the tests you need a clone of the aligned_bach_chorales repository. By default, it will be cloned into your
home directory under ~/git
. To set it up yourself:
- Clone aligned_bach_chorales (submodules not required)
- Point pyMeasureMap's tests to the directory of the clone by setting the constant
REPOSITORY_PATH
to the directory that includes thealigned_bach_chorales
directory.
To run the tests, head to your pyMeasureMaps clone and run tox
.
Once the package is installed, the MM
will be available in your commandline. Typing it will print the available
sub-commands.
Type MM extract -h
to print the help with all arguments.
Parsing all files in path/to/chorales
that music21 can parse:
MM extract -d path/to/corpus # creates measure maps next to the parsed files MM extract -d path/to/corpus -o path/to/output # creates measure maps in the specified directory MM extract -d path/to/corpus -r "^bwv" # only parses files that match the regex (i.e., start with "bwv") MM extract -d path/to/corpus -x .mxl .xml # only parses files with the specified extensions
mm = MeasureMap.from_json_file("path/to/file.mm.json")
mm.to_json_file("path/to/new_file.mm.json")
mm = MeasureMap.from_json_file("path/to/file.mm.json")
compressed = mm.compress()
compressed.to_json_file("path/to/compressed.mm.json")
This project uses pre-commit, please make sure to install it before making any changes:
pip install pre-commit cd pyMeasureMap pre-commit install
It is a good idea to update the hooks to the latest version:
pre-commit autoupdate
Don't forget to tell your contributors to also install and use pre-commit.
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.