A friend of mine once asked me to be his page turner for his music final performance exam. Being in the same CS class (and suffering), we joked about how it would be cool for the sheet music to be able to turn itself at the right moments.

What it does

This hack aims at allowing people to play a portion of a song on an instrument and be able to identify where in that song the user is playing. This is useful for automating page-turning of sheet music on a device and allowing aspiring musicians to more easily follow where they are playing, for instance. The comparison between user input and sheet music is performed via a simple naive fuzzy string search algorithm (the equivalent brute force method of string search algorithms) between the MIDI files of the user input (converted to MIDI) and the sheet music. A proof of concept is built using pre-generated MIDI files and an online website that allows the user to upload a MIDI file to compare against the "sheet music", chosen via dropdown menu.

How I built it

This hack uses HTML5/CSS and Javascript to manage the webpage/files and Finale Notepad software to generate the MIDI files. Alternatively one could use a free and/or simpler music maker program.

Assumptions in the current build

• No trills, dynamic changes, tempo changes, or other articulations. Only accidentals (which aren't really articulations)

• MIDI files are all "type 1" MIDI format (that is, all instrument tracks are combined into a single track)

Challenges I ran into

Getting Javascript to read the file and using Javascript in general were my biggest roadblocks. Since I was already pretty adept at manipulating the other programs already, they were not as much of a hassle as re-learning Javascript. Also, learning the format of MIDI files was a big pain in the butt but overall was much more tedious than challenging.

In the end, I probably should have used C instead for file reading. Sorting through all the javascript documentation updates and finding that most of the methods had little to no useful description or did not work as intended or were deprecated were debilitating to both morale and progress.

Accomplishments that I'm proud of

Basically what I learned in the process of creating this (see below):

What I learned

I learned how to read MIDI files and use them more dynamically (in Finale I would always just use the MUS file and always play with custom instruments instead of MIDI instruments), i.e. for comparison of music files. Also I learned some more HTML and Javascript to help build cooler websites.

What's next for MIDI-based page turner

There are numerous improvements and applications:

• use a better fuzzy search algorithm (e.g. the Knuth-Morris-Pratt algorithm) for better runtime and memory management

• allow the user to find sheet music based on what they can play by ear

• mark correct/incorrect notes

• allow the website to store user sheet music

Built With

Share this project: