Need help with moonlight?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

275 Stars 65 Forks Apache License 2.0 139 Commits 23 Opened issues


Optical music recognition in TensorFlow

Services available


Need anything else?

Contributors list

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

is used by Magenta for training generative music models.

Moonlight is not an officially supported Google product.

Command-Line Usage

git clone
cd moonlight
# 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 \


CLI will print a
message by default, or MusicXML or a
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.

There is no release yet, and Moonlight is not ready for end users. To run interactively or import the module, you can use the sandbox directory.


  • Protobuf 3.6.1
  • Bazel 0.20.0. We encountered some errors using Bazel 0.21.0 to build Protobuf 3.6.1, which is the latest Protobuf release at the time of writing.
  • Python version supported by TensorFlow (Python 3.5-3.7)
  • Python dependencies specified in the requirements.



We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.