RTTTL tunes extension

Ring Tone Transfer Language… is a popular format for tunes. With this library, you can play existing RTTL tunes in Arcade.


This is fantastic! Thank you very much for sharing this. I hope they make this part of the main code.
Using a timer to separately play a melody during a game just got easier. I was so excited by this extension that I just had to put it in my game:


It took me a few tries to get the correct amount of Ts in that name.


For people interrested by finding tunes, this forum post has a bunch https://forum.arduino.cc/index.php?topic=510297.0


0.6 is also microbit compatible.

How does this work? I cannot add the extension to my game.

Add an extension as usual. In the search bar, use the following URL: https://github.com/pelikhan/pxt-rtttl.git

I don’t know why it didn’t work before, but thanks! What do I do now? Is it a ts extension?

It adds one block to the Music category in the toolbox:


Use the links mentioned earlier in this thread to find some RTTTL tunes, or craft your own!


I have noticed that some RTTTL tunes are not playing as expected.

Using this site:

and the ‘Leisure suit Larry’ theme:

sounds a lot different using the extension. Could it be that I don’t have the correct BPM?

Oh man … that tune! Fond memories.

It doesn’t seem to like the 32nd notes. I replaced them with 16th notes, and it was … happier? At least the melody seemed much more familiar.

Anyway, try this one. I shifted the time signature to avoid the 32nd notes. The half-notes still seem to play a little long, but other than that, it sounds accurate. Play it at half the suggested speed (i.e. play it at 112 bpm instead of 224).


1 Like

Hi, @peli !

I sent a PR your way. Feel free to gimme a holler via GitHub if you have any questions.

:pray: I’ll bump later today. For the trim issue, trim before splitting

1 Like

We’ll have to figure a way to share those melodies somewhere.

1 Like

I tried a handful of variations and couldn’t get it to work. I’m not comfortable enough with lambda functions in JS to make the compiler happy. I eventually threw my hands in the air and left it for you. :smile:

Thanks for this extension, @peli ! I’m more comfortable with traditional music notation, so I feel right at home with RTTL notation.

Since you changed the notation I had to find out how the RTTTL format works. :man_shrugging: Wikipedia explains the notation quite well. I see that you have changed the default duration from ‘d=16’ to ‘d=4’, which means also having to divide the notes that do specify a duration by 4.

Thank you Alex for helping me with this, it does sound much better now.

1 Like

Alex fixes + white space issue bundled in v0.0.9!


I will update the library and try some different tunes.

Is github blocked on your domain?