Table of Contents (TOC)
^ TOC
So, you just learnt how to control a buzzer using an Arduino, but you want more then just simple beeps and hums - you want to assert your dominance over the sound-waves to show-off how well you can control the buzzer.
Cynical? Well there's no denying that it's a sentiment that we all share once we learn something new, but hey, if you've managed to acquire and get an Arduino working, then that's quite far an accomplishment.
A quick search of "music buzzer arduino" should point you to the right direction, but no-one has the time to individually hand-code and map the midi-tones to the frequency values that the Arduino's Tone function requires, especially if you're working with a long MIDI track.
The solution?
https://www.extramaster.net/tools/midiToArduino/Circuitry
^ TOCWiring the Buzzer is trivial, just place the buzzer on two strips (on a breadboard), connect one strip to Pin 11 on your Arduino, and the other strip to the Ground.
Demo
^ TOChttps://www.youtube.com/watch?v=B1oHQzp1P3w
https://www.youtube.com/watch?v=4FDFpycApP4
Note that this also works with Raspberry Pis.
https://www.youtube.com/watch?v=HOisQF-JaS0
Steps/Instructions
^ TOC- Visit: https://www.extramaster.net/tools/midiToArduino/
- Upload a midi file
- Choose the track that you want to export
- Copy the resulting code to a new Arduino sketch
Sample Exported Arduino Code
^ TOCDidn't get the midi file to work with the web app? No worries, here are some sample code generated by the web-app
Midi: Fleuron-128 - Heaven - Song: Shaun Frank & KSHMR - Heaven (feat. Delaney Jane)
Midi: Antergy - DB15 - Song: Atmozfears - DB15
Midi: Kevin Fishburne - Terra's Theme - Song: Final Fantasy VI - Terra's Theme
https://www.extramaster.net/tools/midiToArduino/Final Notes
^ TOC Oh, and by the way, it appears that you can leave the Piezo buzzer running on loop for an extensive amount of time (24 hours+), so if you want to play a midi indefinitely, you can use an Arduino to do so.Unfortunately, you can only have one tone running at a time, so if your midi track has multiple keys being played simultaneously, expect some wacky results. (here - try this: http://www.forelise.com/midi - "Track 2: Acoustic Grand Piano - Piano - Fr Elise")
If you attempt some protothreads hack, then expect only one Piezo buzzer to work (at a time). But if you're game, and want to give using protothreads a try:
https://www.extramaster.net/tools/midiToArduino/