Sonic-Pi 2 Performs

SP2Performs

I have today published on youtube a performance compilation of 18 pieces which I have developed for Sonic Pi 2 (beta). You can view it here

6 pieces by Bach:
Minuet in G
2 Part Invention no 8
Trio 1, II and Polacca from
Brandenburg no 1
Prelude in C Major

Funeral Music for Queen Mary
by Henry Purcell

A Jigge Ye Firste
by Richard Reade

Coranta by William Brade

John South His Galiard,
Earl of Essex Galiard
by John Dowland

Revecy venire du printans
by Claude Le Jeune

Pastoral Symphony from
Handel’s Messiah

3 Beatles Songs:
Eleanor Rigby
Penny Lane and
When I’m sixty-four

Maple Leaf Rag by Scott Joplin

Puppet on a String
(Sandie Shaw arranged
by Alan Simmons)

A few of them started life as pieces on the original Sonic Pi, but the way they were written was very different, because of the severe limitation that version has on synchronising threads together. So all of these pieces have been developed over the last couple of months. They mostly use the same technique that I have developed for playing polyphonic music on Sonic Pi. Separate arrays hold the information the pitches of the notes for each part, and for their durations. For ease these are entered respectively using symbolic notation like :c4, :fs5, :gb3 (C 9octave 4), Fsharp octave 5, Gflat octave 3) for the pitches and variables I have defined such as q, sq, cd (quaver, semi-quaver and dotted-crotchet) for their durations. In a couple of pieces I add dynamic volumes for each note with a separate array using variables I have defined such as p, mp, mf and ff (piano, mezzo-piano, mezzo-forte and double-forte). These enable me to add crescendos and diminuendos to the music. In other pieces I set the overall volume for each section, altering them to provide colour. The other area that needs attention is the choice of synthesiser and the ASR (Attack, Sustain, Release) envelope associated with each note.

A couple of pieces have percussion parts: The Funeral Music for Queen Mary by Henry Purcell has a tenor drum, and A Jigge-Ye-Firste by Richard Reade has a sort of tabard accompaniment. I recorded my own sample notes for these, and developed a way to play them at the appropriate times alongside the notes being played.

Several pieces also feature ornaments in the form of trills. Initially I wrote these out note for note, but then I developed functions in Ruby (the native language in which Sonic Pi is written to make it easier to do. Likewise over the duration of writing these pieces I developed techniques to enable rits or changes in tempo to be catered for – not easy when the rit takes place over the duration of a trill ! You see this to good effect at the end of the first section of the Purcell piece. This also makes use of the pan attribute for a note which enables you to place it in the stereo spectrum. When the brass starts playing antiphonal music (two sections answering each other) I place them on the left and right to enhance the effect. If you have good stereo speakers you should be able to detect this.
Another useful feature I often use is to add a little reverberation using the with_fx reverb: command. This can “lift” the piece making it more interesting to hear.

You may wonder at the choice of repertoire. It is partly because I like Bach and early music, but also because these genre lend themselves very well to Sonic Pi. The pieces all have a strong rhythm, and are perhaps less dependent on frequent crescendoes and diminuendos or variations in tempo as might be the case in a romantic symphony. Such ways of colouring the music are not easy to achieve with Sonic Pi. Also, Sonic Pi will begin to show the strain on a Raspberry-Pi once you get beyond 4 or 5 note threads playing at the same time.

There is one major new use of Sonic-Pi 2 NOT included in these pieces. That is the use of Live Coding, whereby you can start a piece running in a loop, and then isolate that loop, leaving it running, but redefine the code within the loop, so that you produce real time changes in the music as it plays. I have experimented with this, and hope to add further offerings using this technique in the future.

In the meantime I hope that you enjoy the pieces in Sonic-Pi 2 Performs. I shall shortly be starting a series of video tutorials on youtube, which will explore some of the techniques of writing for Sonic Pi, and which will also in later videos feature the code of some of these pieces.

A zip file of the individual sound tracks can be downloaded here

3 thoughts on “Sonic-Pi 2 Performs

  1. Pingback: Sonic Pi 2 performs – music on the Raspberry Pi | Raspberry Pi Pod

  2. Pingback: ใช้ Sonic Pi 2 บรรเลงดนตรี | Unofficial of Raspberry Pi Fan in Thailand

Leave a comment