Just before I do disappear down a rabbit hole… has anyone written a parser or translator from RTTTL ringtone format to Sonic Pi code? On the face of it the transcription is straightforward and there’s a decent Python module for parsing RTTTL. I suspect I’m about to write a script which does the conversion for me, but if anyone’s beaten me to it I’d be delighted!
I liked the look of this and had a play with it this afternoon. I used the python module and added a couple of files to get everything playing in Sonic Pi.
First I added a python script sp_json.py which takes a named ring tone as an input parameter and produces a .json format file named sp_tune.json.
I then wrote a Sonc Pi script which loads in the two data lists from the json file and then plays them. They are easy to play in Sonic Pi because it has a hz_to_midi command built in. The script is arranged to play all the tunes stored in the songs.py file automatically one after the other. I play them using the chiplead synth. i also found it better to transpose the files down an octave. You can also easily alter the tempo if you wish.
You just have to make sure that the paths are set up correctly. It takes several minutes to play all the tunes.
I added the two files to a fork of the python module here
There are comments in the scripts which should get you going.
EDIT further files and a README file added. See my later post here
Here is an audio file of three of the ringtones played by Sonic Pi
Hah! Robin, at this point you’re basically my Sonic Pi Genie. How many more wishes do I have left?
I’ll have a play tomorrow or Friday - hoping to glue this bit together with your OSC broadcast stuff from last week to get Sonic Pi sending selections from a vast ringtone library out to a a network of robots. Results soon!
I have done a broadcast OSC version as well. I’ll post it tomorrow
I’d also like a pony, and world peace. K thx bye.
Can’t manage the pony and world peace but I have now updated the repository with an OSC version. The files you need are in the sonic_pi folder. Note this has soft links to the rtttl.py and songs.py files. You can add these files explicitly to the sonic_pi folder from the parent and then the sonic_pi folder contains all that you need. look at the README file for details of usage. You can of course edit the songs.py file and add your own rtttl files. In this case you will need to update the list of songs in the Sonic Pi program as well.
Finally if you are running different types of computer with Sonic Pi you may need to make adjustments because of latency to keep them properly in sync. This can be done by adding delays to the lower latency machines in the playring live_loop so that they sound at the same time as the slower machines.
updated repository link is the same as in my reply here