Sonic Pi plays OUD


Following a recent holiday in Morocco, I have coded a sample based piece where Sonic Pi plays a typical OUD melody. (The OUD is an instrument rather like a lyre, used in North Africa and Middle Eastern Countries). The program describes what is done with a voice commentary as it proceeds.

You can listen to it on here.

You can download the program and the samples from a git repository here.

Sonic-Pi 2.1 is released


The new release of Sonic-Pi 2.1 is welcome news to both seasoned users of the program and those who have yet to dabble with it for the first time. For the former, some dozen new functions are added with improvements to others, and the efficiency of the program, particularly when running on the Raspberry Pi. The help system has been overhauled and it is possible to bring up the documentation on a built in keyword by pressing F1 when the cursor is within the word in the code window. Also for power users, a comprehensive set of keyboard shortcuts is supported by the program, and a “cheatsheet” in the help system lists them all very clearly.

The examples section  incorporated in the help system has been reworked and brought up to date, with further ones being added, and in particular a piece by Meta-Ex (Sam-Aaron’s performance name) is included. This sounds fantastic, and contains some very sophisticated code, which will not be for the faint hearted, as it includes use of Ruby language code upon which the operation of Sonic-Pi is based, but it provides a marker to show just what can be achieved with Sonic-Pi. Users can look at this section by section and experiment to understand how it works.

For beginners, the good news is that the tutorial system is now incredibly comprehensive. It is almost a small book in its own right. It has never been so easy to get going with Sonic-Pi and if you have never used it or have had a dabble with previous versions then I urge you to look at at 2.1

One of the main aims of Sonic-Pi is to enable live coding: the ability to compose and play music, and then alter it whilst it is playing. The new live_loop function makes this quite easy to do. You can add and subtract such loops, and have them interact and synchronise together using the cue and sync system supported by Sonic-Pi. This is an exciting area of use, and your imagination is the only limit as to where it can take you.
For those who like more traditional music, Sonic-Pi is great for playing music transcribed into its notation. For those with musical knowledge notes are easily entered using constructs such as :g4,:a4,:b4,:c5,:d5,:e5,:fs5,:g5 which gives a scale in g major, although this is more efficiently encoded as scale(:g4,:major)
Personally I have transcribed a wide range of genre from Purcell and John Dowland, to Scott-Joplin and the Beatles to play on Sonic-Pi.

Another area where improvements have been made is to increase the number of built in samples within Sonic-Pi. Sounds can be made either by using the built in synths which generate sounds electronically, or by playing prerecorded .wav file samples. The samples now included a wider range of drum samples. Synths too have been increased in number, particularly by including a number of noise generators of different characteristics.
The user can also easily add their own .wav file samples. I have personally used this with samples from The Sonatina Symphonic Orchestra to build additional voices with which to play in Sonic-Pi. So far I have added A grand piano, a xylophone, a flute, a harp, a glass armonica and a peal of church bells, as described in articles on this blog.

The future: Sonic-Pi is not finished, indeed by its very nature I think it never will be, because users and developers will always have ideas for further improvements and enhancements. One thing which didn’t make it into version 2.1, despite work being done on it, is to overcome the present limit of about 9000 characters in a workspace. Technically this occurs because of limitations in the communications method used to send OSC (Open Sound Control) messages between Sonic-Pi and the supercollider based server which produces the final sounds. Work done on this so far has not yet produced an alternative which is fast enough. This is not a problem for the majority of users, because you will only notice it if you write long programs.

Finally, Sonic-Pi is not only available for Raspberry Pi. Download versions are also available for Mac OSX and now for Windows. The github site also contains instructions for installing it on a Linux Box (I have it running under Ubuntu 14.04 LTS) So what do you have to lose? Upgrade or install it for the first time today by downloading from

Nice to be back…and writing for Sonic Pi again

Yours truly on a camel just after dawn!

Just had two weeks in Morocco. Great country, and scenery. I did miss Sonic Pi though, and it’s nice to be back and using it again. This afternoon I have been exploring creating new samples using Sonic Pi and then incorporating these in other Sonic-Programs. I had a play with some live_loops and created quite a nice sound involving some c minor scales. I used three different synths and used Sonic Pi to record the sounds played. The repetitive sound sequences lasted four seconds, and I used the open-source audio editor Audacity to accurately trim the three samples to four seconds each. I then started a second Sonic Pi program which used these three samples as source material overlaying them with a slight delay between each one, and then repeating the overlay with the samples played in reverse. The whole cycle was repeated seven times in a thread, and the system volume was controlled so that the sound faded in smoothly over 12 seconds and faded out at the end of the sequence during the final 12 seconds. I liked the final effect, and I hope that you do too.

Unfortunately the program is a bit too taxing to work 100% on the Raspberry Pi, but it goes ok on a Mac. (and should be ok on a Linux Box or with SP on Windows)

A recording of the completed piece is here

Listings of the two programs together with download links, and links to the samples are here