MIDI Start
1 Playing with the basics
I started from Tom's MIDI-USB tutorial and understood how Arduino communicate with the synthesizer. I downloaded the SimpleSynth so that I can have the output. I decided to add a channel to make the sound more vivid. So I repeated the melody in channel 1 (0x91) so that the output can have 2 tones.
2 Hedwig Melody
Hedwig Theme
To let the computer sing a song, I need to input the melody series in the Arduino. I found the melody online and it's the peizo speaker version, which meant that the notes defined were frequencies inside of MIDI notes. So I need to convert them to MIDI notes. By using the following table, I successfully converted the notes to MIDI numbers.
Speed Adjustment
I add a tempo to dynamically change the delayDuration between notes so that I can change the speed of the song.
Appendix
Full code please view on Github HERE.