A Remote RTTTL (RingTone Text Transfer Language) Song Player

Check out the readme.md on github for all the details and source code:

Youtube video in action:



This is outstanding!

1 Like

Is it possible to get the rtttl part of this converted into a library? I would love to be able to use it for my doorbell :slight_smile: I just dint know where to begin troubleshooting why its not working for me. I have tried doing it myself using the arduino tutorial on libraries… but just cant get it working.


There’s a song stuck in my hand recently :l

Its pretty awesome, the type of tunes make them really catchy. This site has so many songs, some don’t sound quite right, but most are pretty good.


oh hell yes. this just made my day.
i hope this is for what i think its for :smile:

Love this! Works just as well with a piezo buzzer :slight_smile:


oh my, my geek is enthralled…but did you really have to go with Rik A. only Justin B could have been worse! :smile:

This is very cool. But my ear is twitching! I’ve not looked at the code, but are you rounding the frequency values to the nearest Hz?

1 Like

What do you have perfect pitch? :smile:

The notes are defined as half period for each note in microseconds, output is bit banged with low level 27ns instructions, delayMicrosecond() is used, and the for() loop adds a tiny bit of overhead. I didn’t tweak the note times to account for this overhead but I do recall them being pretty spot on with my Rigol o’scope. If you want better timing, the built in tone() and noTone() are probably going to be a better bet :wink: I should re-write this as a proper library using the built-in functions!


Hehe, yes kind of - I’m a concert pianist, and a lead of a barbershop choir so I suppose I’m used to hearing stuff. But no fault of yours - you really have to work crazily hard to get electronics to play an accurate tone. But I’m really just pulling your leg - my jaw hit the floor at hearing this! Totally awesome!


So the Rick Roll tune I kind of found, but it was bad… and then I had to listen to the damn video over and over and try to fix the RTTTL notes to match it as best I could. Let’s just say that I’ve learn to love the song… lol. I can’t let it bother me or there’s no way I could have gotten this done! Key points: (1) Rick Roll everyone… (2) Enable others to remotely Rick Roll their friends and family… and enemies :wink:


Now I have an idea for a spark core virus…rick roll everyone at midnight! muhahaha!

1 Like

This is my favorite at the moment… its my current doorbell :mega:

char *song = (char *) "Titanic:d=4,o=6,b=40:32c#.6,32d#.6,4f6,32d#.6,32c#.6,32d#.6,32g#.6,8g#.6,32f#.6,32f.6,16c#.6,8a#.5,32g#.5,32f#.5,32d#5,32f5,8d#.5,32c#.6,32d#.6,4f6,32d#.6,32c#.6,32d#.6,32g#.6,8g#.6,32f.6,32g#.6,8a#.6,8g#.6,32d#6,32f6,8d#.6";

And these may be of interest to someone… i couldn’t find anything pre-made for my door access system… so i made my own

char *denied = (char *) "denied:d=32,o=6,b=100:4a,a,2p";
char *allowed = (char *) "allowed:d=8,o=5,b=112:c6,4f6";

and if you want to know print the name of the song… as i did when loading songs over serial port… in the begin_rtttl i added a line in the bit that normally skips the name :smile:

while (*p != ':') {
        Serial.print(*p); //dont ignore it.. print it 
        p++; // ignore name 

Good fun to play with.

I couldn’t resist tweaking it a bit to allow song selection as the arg on remote function was there for the taking. I moved all the song data into a struct array and the parameter then selects the song from its title or “random” picks a random song.

Forked version at tweaked rtttl

I really like this idea, so I incorporated it into my alarm clock project, Mane Avis, and what I’d really like to do is be able to send these to the Photon using a cloud function, but with it’s limit, I’m not sure that’s the best way. I’m also not sure how/where I want to store it/them. I’m already storing the alarms in “EEPROM”/flash although, I probably will never need ~180 alarms so I could probably spare some space there for one or two. Thoughts?

I forked and got it converted to a library so that my main application will be much simpler by just calling the class functions

Do check my repo out: https://github.com/zenvisuals/Remote-RTTTL

Hope it helps!

1 Like

We have tone() implemented in hardware now, which would be even better for your library conversion :wink: If you want to give this a try that’d be awexome. Also would love to see this make it into the Particle Libraries online if you are up for maintaining it. If not, please submit a PR to my original repo and I’ll maintain it.

1 Like

Awesome! Thanks very much for the update!

I’ll be happy to try out the tone() function and update the current codes. Not sure if I have the time to maintain it but I have sent you a pull request to add on to your repo,please let me know if you didn’t receive ;).

I see if I have the time to update the codes next week and let you know again. Cheers.

NIce! @zenvisuals I do see your PR now in the middle of about 150 unread emails (mostly different github notifications). Thanks for that, and I’ll wait for the update with tone() before testing and pulling it in.