Skip to main content

A python implementation of MV2H metric

Project description

badge PyPI license PyPI version fury.io

pyMV2H

A pure-python implementation of MV2H metric, the original repo can be found here.

For a more easily use with python frameworks, like PyTorch and Tensorflow we implement this repo.

Usage

Using by shell:

pyMV2H
Usage:
  pyMV2H midi_converter -i <input_dir> -o <output_dir>
  pyMV2H compare_files -g <reference_file> -t <transcription_file> [-a] [-p]
  pyMV2H -h | --help
  pyMV2H --version
Options:
  -h --help                         Show this screen.
  --version                         Show version.
  -o --output                       The output file
  -t                                The transcription file
  -g                                The reference file
  -a                                Align both files
  -p                                Set the DTW insertion and deletion penalties
Examples:
  pyMV2H compare_files -g <reference_file> -t <transcription_file> -a -p 2.35
  pyMV2H midi_converter -i <midi_file> -o <output_dir>
Help:
  For help using this tool, please open an issue on the Github repository:
  https://github.com/lucasmpaim/pyMV2H

Using by python code:

pip install pyMV2H

Convert midi files:

from pyMV2H.converter.midi_converter import MidiConverter as Converter
reference_midi_file = '<midi dir>'
reference_file = '<reference txt output>'

converter = Converter(file=reference_midi_file, output=reference_file)
converter.convert_file()

Compare files:

from pyMV2H.utils.music import Music
from pyMV2H.metrics.mv2h import mv2h

reference_file = Music.from_file('<reference_file_dir>')
transcription_file = Music.from_file('<transcription_file_dir>')

print(mv2h(reference_file, transcription_file))

Citation

Please, cite the original article:

@inproceedings{McLeod:18a,
  title={Evaluating automatic polyphonic music transcription},
  author={McLeod, Andrew and Steedman, Mark},
  booktitle={International Society for Music Information Retrieval Conference (ISMIR)},
  year={2018},
  pages={42--49}
}

Important

For convenience at this point, python version doesn't include support for multi-tempo or chords, this repo is implemented for MIDI AMT's algorithms research, and the original repo doesn't extract this info from MIDI files. ref.

Next Step's

  • Support for multi-tempo

  • Reduce the number of dependencies

  • Add support to chords

  • MusicXML parser

  • Write unit tests

  • Increase the number of Unit Tests

  • Refactor code to be more pythonic

Project details


Download files

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

Source Distribution

pyMV2H-1.1.0.tar.gz (118.6 kB view details)

Uploaded Source

Built Distribution

pyMV2H-1.1.0-py2.py3-none-any.whl (24.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyMV2H-1.1.0.tar.gz.

File metadata

  • Download URL: pyMV2H-1.1.0.tar.gz
  • Upload date:
  • Size: 118.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for pyMV2H-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7cf47dd3e36ef7bf852121fe850869b2c7430024dbdb6d1150b51aa60cd911af
MD5 82ed4969f8cbc65f26dcb55136d63502
BLAKE2b-256 fea2090977a07ed5bfd6274cf5effaa208121e31a8ab9f163b622cb805613494

See more details on using hashes here.

File details

Details for the file pyMV2H-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pyMV2H-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for pyMV2H-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 43a976e9b5cb5eaa9c02bb658cc92b16ddbdba00d48c3ff40bbcc39c091f6e60
MD5 705884eebe6eb0bd3e6534c72289dd6f
BLAKE2b-256 a07f2d15be8a34d999e94c5b46a2cd6299f676ad34afccec607a3b9eb445d6a0

See more details on using hashes here.

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