This project came out of my previous one to control Sonic Pi via my Mobile Phone using Telegram. Since I have quite a large repertoire of Sonic Pi tunes I have found it very convenient to use this script to access and play them, without having to open them in a text editor and copy and paste the contents into a workspace first.
You need to have Sonic Pi running, and an open terminal window in which to run the Ruby script jukebox.rb
The script makes use of Nick Johnstone’s excellent Sonic Pi command line interface.
It has configurable path variables which point to the desired folders containing the Sonic Pi files to play, a samples directory for any user defined samples required, and to a folder which can contain subfolders of linked files, where each file uses Sonic Pi cue and sync commands to start the next one playing. A final path variable points to the installed location of the sonic_pi command line interface binary which will be different on a Pi or Mac.
Full installation details are here
Having spent some time writing programs to get Sonic Pi to work as a jukebox, either controlled by a mobile phone or locally, I thought it was time to get back to coding some music. Previously I had had a brief look at the Dr Who theme, but had got a bit stuck with it. On taking a fresh look, I managed to complete the coding this afternoon, and I am quite pleased with the overall effect.
See what you think
You can listen to it here
You can download the code here
Click images above for two videos
You should be aware that the latest version of Sonic Pi (2.7) does NOT work with the command line interface detailed below. I have advised the author of this fact, and hopefully it will be fixed in the future. For now you need to use version prior to 2.7 for it to work
Just after I had written the project detailing how you could control GPIO connected devices from a mobile phone using the telegram.app, a reader suggested that it would be nice to add an autoboot option to the project. At the same time, I found a new project creating a command line interface for Sonic Pi. I killed two birds with one stone, and developed not only an autoboot addition for the first project, but also a Sonic Pi Jukebox setup, which lets you use a headless Pi and control it from a mobile phone, tablet or desktop fitted with the free app Telegram. It works best with a Pi-2, but also is ok on a B+)
If you have not already done so, you should work through the first article initially which details how to install and set up telegram on the Raspberry Pi. I have added a QUICKSTART route which lets you skim past the GPIO bit if you only want to do the Jukebox.
The new second article details how to add the automatic boot and logon for both the GPIO and Sonic Pi Jukebox. and details how to install the sonic-pi-cli and the code to utilise it.
Click the picture for a video of the project in action
Recently I came across an article which used the free chat program telegram to enable a Raspberry Pi to interact with a mobile phone and allow the former to control various actions in response to messages sent from the mobile phone. I have done further development work on teh original article and produce a full write-up article which enable you to control two leds and a buzzer and also to take and send photos from your Pi back to your phone.
I used the contents of the CamJam Edukit #2 to set up the leds and buzzer, using one of the worksheet examples they supply.
Full article details and downloads are contained here