So I spent a few hours today reworking the RTTTL function that Brett Hagman has created (which I got from here), and it was a great example sketch, but it stores the song’s in flash, which is typically fine, unless you have the SD library enabled. I based my RTTTL code in the VDay 2012 project on Brett’s sketch, except it was modified to save everything into a big buffer(and with interrupts).
Now I have removed that buffer, and rewrote it to be a state-based function. Since I’m dealing with many different libraries, I rewrote this to not be interrupt based, so that it is simple to add to existing code. The sketch size is 10650 bytes with all 35 RTTTL ringtones enabled, with only the minimal song enabled, it is 2544 bytes.
Here it is in all its glory. Enjoy!
Edit: I updated it to fix two bugs I found 🙂 Here is a video showing what it sounds like (yes, that is the VDay 2012 video)