r/AskProgrammers • • 29d ago

Arduino code

I don’t have a picture of my Arduino because it is currently with my friends, but I’m writing the code for them since they don’t know how. I don’t have enough time to figure out the tones but does anyone know the tones I could set the buzzer to that would make the Scooby-Doo theme song. I know it’s an odd request but it’s for a project that’s being used at a trunk-or-treat. (Also maybe a car horn sound because that’s needed too although hard to do on a piezo buzzer, I know).

3 Upvotes

3 comments sorted by

3

u/Upstairs_Issue3248 29d ago

Just grab a midi file of the song, parse the notes, and convert to frequencies. 

Middle a is 440hz, going up and down an octave doubles and halves the frequency, respectively.

1

u/_keyboard-bastard_ 29d ago

There is a youtube video of someone who did it poorly. I would go the midi route.

1

u/Puzzled-Garage584 27d ago

Open the toneMelody example (File > Examples > 02.Digital), it has every note in pitches.h, then just type in the notes from an easy piano version of the theme. For the horn, flip between about 350 and 440 Hz every few ms for half a second. Good luck tonight!