Skip to main content

Python implementation of the MeasureMap specification

Project description

Project generated with PyScaffold

pyMeasureMap

Python implementation of the MeasureMap specification

Usage

  1. Clone the repository

  2. 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]"

Running all tests

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 the aligned_bach_chorales directory.

To run the tests, head to your pyMeasureMaps clone and run tox.

Command line interface

Once the package is installed, the MM will be available in your commandline. Typing it will print the available sub-commands.

Extracting measure maps

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

Loading and writing

mm = MeasureMap.from_json_file("path/to/file.mm.json")
mm.to_json_file("path/to/new_file.mm.json")

Compress a MeasureMap object

mm = MeasureMap.from_json_file("path/to/file.mm.json")
compressed = mm.compress()
compressed.to_json_file("path/to/compressed.mm.json")

Making Changes & Contributing

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.

Note

This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyMeasureMap-0.1.tar.gz (41.3 kB view hashes)

Uploaded Source

Built Distribution

pyMeasureMap-0.1-py3-none-any.whl (24.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page