Ever wanted an easy way to play fun little melodies and songs on an Arduino, without the need to hardcode the notes? Well, here you are!
SerialMusic just takes a few steps to use:
- Flash the Arduino with the sketch.
- Connect a speaker to Arduino digital pin 9 and ground.
- Run the provided Python script "Note Server"!
SerialMusic comes with a built in demo ("Your Reality" from Doki Doki Literature Club!) accessible from the Note Server's demo command, but also comes with a few example external note files. And with a few minutes work, you can make your own note files due to the extremely simple syntax:
140 - BPM (beats per minute)
C4 8 - <note+octave> <note length in sixteenths> Therefore, this is middle C as a half (8/16) note
CS4 8 - This is how you indicate a sharp note. SerialMusic does not use flats for simplicity.
D5 1 - D5 sixteenth note
E5 1 - any content on a line after the note length will be ignored.
SerialMusic makes use of Connor Nishijima's excellent GPLv3-licensed Volume3 library. Volume3 is available through the Arduino IDE's Library Manager as well as its Github page, but for convenience it has been included here. If needed, merge the included libraries directory with your existing Arduino libraries.
SerialMusic was created by Matthew Petry (fire219/fireTwoOneNine) and is licensed under the GPLv3 license -- see LICENSE file for more information.