Using the buzzer speaker thingy!
I did the default song, and Ode to Joy. I found a handy list of notes and their frequencies here.
For anyone who wants the code for Ode to Joy:
Plug this into char notes:
and this into int beats:
I also had to add the low G into the notes (the uppercase G in the notes above if you want to use a different character), the frequency is 196. The tempo I used is 100.
Edit: just wanted to add a little bit of explanation as in the code, it says that a ‘1’ in the beats indicates a quarter note – I made mine so a ‘4’ is a quarter note to allow for eighth notes and sixteenth notes. I didn’t use any sixteenth notes here, but I wanted to keep my options open and methods consistent. I didn’t want to mess around with any variable types (int does not deal with decimals) if I wanted notes shorter than a quarter note. Hence 4 being a quarter note, 1 would be a sixteenth note, etc.