This post is incomplete and littered with spelling errors. I’m only posting to shame myself into finishing it after sitting on this draft for the past 5 months

https://github.com/NotJoeMartinez/MusicNotesML https://github.com/aashrafh/Mozart


Last year I participated in the Microsoft Student Hackthon. There was a “Hack For Education” challenge and I wanted to make something that would have helped me when I was a music student. I played the violin for 8 years while I was in grade school and I always struggled to read sheet music.

Some music theory

It’s been a while since I’ve actually played my violin much less analyzed sheet music (so go easy on me) but this is by best explanation of an excerpt from marry had a little lamb. If you already know how to read sheet music you can skip this part.

03f1f69e0de12ca6fb3b3b632be21c32.png

This symbol means the notes are in the Treble clef 8487338d2533ece7cf0a92d617460113.png There are a bunch of clefs used to write music for different instruments usually
corresponding to how high or low of a pitch an instrument can produce. The violin uses the Treble clef which is used for higher pitch instruments. Depending on the clef the symbols to the left of it map to different notes to play. 7f398a11034d74f17bfd1b8782c159cb.png To the right of the treble clef is the key signature 5f13ba5c4389a78c86bfb1104aa716cb.png A key signature is a seres of sharps ♯ or flats ♭ placed to the right of the clef. These serve as a way to tell the musician to shift the notes up or down semitones. So basically the more sharps in the key signature the higher pitch the music will sound and the more flats the more depressing it will sound. 7b2fc286c98f552e2f34c40eeb0fc497.png

These things are the notes 15250bc435afce88d9eb23bd39ac84f4.png if we look at them by them self (without the lines in the background) they are just three sets of four “beats” and one long beat at the end. Without the staff they don’t have much meaning.

Behind everything is the staff 07510e33d2e00ddccb383e5f4b4e8529.png The staff is five horizontal lines that also represent musical pitch. When note symbols are place on, below or in between the lines of the staff they represent a unique pitch that has a letter in the musical alphabet ranging from A to G. Notes lower on the staff will have a lower pitch and notes higher on the staff will have a higher pitch. There are only 7 letters in this alphabet the letters will repeat them selfs once they reach G.

This is what a every note on G major maps to over two octaves meaning that the G on the left will be played in a different way than the G on the right. (I know it’s confusing stick but with me) f4b711844ec5597ac13a38b6896c2639.png

How these notes map to what your fingers do

Simply put sheet music is just way of telling you what to do with your fingers and bow to play a peice of music. A violin has four strings G, D, A and E violin.png

Humans have four fingers. Each string on the violin has a four (really eight) specific places where you can put down a finger while bowing and it will produce a note. This is known as this configuration is known as “first position” because there are a few more ways to hold the violin but this is the main one. first_pos.png

Because the violin is such an elitist instrument these finger positions are not marked by anything unlike frets on a guitar. This means players need to gain muscle memory of where their finger should be, this is usually done with the help of tapes in the location of the finger areas. fa984fbb1761289557784e5fb2cb132f.png

Fingering

It took me years to finally stop using finger tapes. But something that I struggled with much longer was mentally mapping the notes on the page to the fingers I needed to have down. A way beginners get past this is by writing the finger numbers down on the sheet music like this. 5ce4eb92a217c00b12f260f2d2bec010.png A quick search of “fingering” in the r/violin sub reddit shows some more real world examples dcf932a66c2e4554979d223ffbd68a84.png 3ea78386cd85fa39654c84c91a2ad729.png

PhotoMath

PhotoMath is an application that uses optical character recognition to allow users to scan hand written or printed math problems into a calculator that solves the problem in front of you, even showing the solving steps. c63bcfd7e4b77d6c8eaa0cba186ee4a7.png This technology has been around for years and I was always hoping that one day something similar would come out for reading sheet music ( a photo math for sheet music). Ideally the final product would allow users to upload an image of sheet music and it would augment the proper fingerings over the image or other use full information.

Optical Music Recognition

Optical music recognition (OMR) is a field of computer vision interested in reading musical notation from sheet music. It’s similar to optical character recognition although there is much less research in this area.
761f9491aeed30f20c3e780f856511c9.png

ML ain’t easy

Full disclosure, Machine Learning and computer vision is basically magic to me. I was once tasked with building a quality control system as a research assistant for a lab at my university and failed miserably after sinking about six months of my life into the project. Turns out my experience writing dumb python scripts doesn’t translate well to a field that requires a deep knowledge of advanced linear algebra and calculus. However in my desperate attempts to produce something of value, I did manage to pick up a few “tricks” which allowed me to experiment with the power of ML technology without understanding how it works. There are a bunch of tools that abstract the complexity of ML behind a couple python libraries so dummies like me can get a prototype working with little effort. During this overnight Hackathon, my team and I managed to get a working proof of concept web webapp. When given a properly cropped excerpt of music, it returns an image with the proper fingerings overlaid. We even got it to work with several instruments. However this would not have been possible if we tried to build the model from scratch. (even if you gave me six months) demo.gif