/moonlight

Optical music recognition in TensorFlow

Primary LanguagePythonApache License 2.0Apache-2.0

Moonlight Optical Music Recognition (OMR) Build Status

An experimental optical music recognition engine.

Moonlight reads PNG image(s) containing sheet music and outputs MusicXML or a NoteSequence message. MusicXML is a standard sheet music interchange format, and NoteSequence is used by Magenta for training generative music models.

Moonlight is not an officially supported Google product.

Usage

# You may want to run this inside a virtualenv.
pip install -r requirements.txt
# Build the OMR command-line tool.
bazel build moonlight:omr
# Prints a Score message.
bazel-bin/moonlight/omr moonlight/testdata/IMSLP00747-000.png
# Scans several pages and prints a NoteSequence message.
bazel-bin/moonlight/omr --output_type=NoteSequence IMSLP00001-*.png
# Writes MusicXML to ~/mozart.xml.
bazel-bin/moonlight/omr --output_type=MusicXML --output=$HOME/mozart.xml \
    corpus/56/IMSLP56442-*.png

The omr CLI will print a Score message by default, or MusicXML or a NoteSequence message if specified.

Moonlight is intended to be run in bulk, and will not offer a full UI for correcting the score. The main entry point will be an Apache Beam pipeline that processes an entire corpus of images.

Resources

Forum