I took the numbers and using c# output them into 2 different ways to generate frequencies to output as tones. First method was simply multiplying each number by 100 to get the frequency in playable range. The second method was converting each number to binary then getting the sum of the ones within each binary number, a method found to be used for storing music information.
I’ve been toying around with playing music using simple tones on the Arduino. I’m no composer or musician so looking around for sheet music I eventually stumbled across MXL files on a few sites like MuseScore.com. Below I have posted a sample of the Arduino playing the Stranger Things theme song.
MXL is a compressed XML file that contains the Sheet Music data, Credits, Parts, Voice Definitions, Notes, Tempo and Durations along with other information. Basically a universal format designed for composing music, project sharing and several additional applications.
Ok so MXL files, what I keyed in on was that the MXL file contained the Notes and their Durations. This is perfect because you can create a simple Arduino code to play notes if you have this information. Sorting through these files is very daunting and time consuming so I decided to create a simple app to parse this information to use it more easily.
This app was banged out pretty quickly so please forgive possible errors. Because some MXL files are compressed and others are not I built in the code necessary to unpackage the XML before parsing. The app allows me to separate the notes by voice with their durations. In addition I placed a numeric control that limits the amount of notes that get parsed. A screenshot example is on the left.
Huge thanks to Shvelo who’s Ruby code got me pointed in the right direction.
Playing the Stranger Things theme song on the Arduino was a bit tricky tweaking the tempo to make it sound right but way easier without having to manually extract the notes and durations. To the left is the simple Arduino setup using piezo from a walkie talkie wired to pin 8 and ground on the controller. Ignore the other wires because they’re not used here.
Instructables with sponsorship by Microsoft is holding a contest for the best Instructables that are code related. The contest is called Coding Creations and among many prizes is a surface pro 3 and a Spark Prototyping Bundle. The judges prize is for the “best use of Visual Studio, Microsoft Azure, Kinect/Xbox, Windows Phone apps, or any Windows app” so if anyone has any ideas let me know.