Sonic Pi - Making, Mixing and Live Coding Music

Two performances did seem to transcend the present, with artists sharing music that felt like open-source software to paths unknown. The first, Sam Aaron, played an early techno set to a small crowd, performing by coding live. His computer display, splayed naked on a giant screen, showcasedSonic Pi, the free software he invented. Before he let loose by revising lines of brackets, colons and commas, he typed:
#This is Sonic Pi…..
#I use it to teach people how to code
#everything i do tonight, i can teach a 10 year old child…..
His set – which sounded like Electric Café-era Kraftwerk, a little bit of Aphex Twin skitter and some Eighties electro – was constructed through typing and deleting lines of code. The shadowy DJ sets, knob-tweaking noise and fogbank ambient of many Moogfest performers was completely demystified and turned into simple numbers and letters that you could see in action. Dubbed “the live coding synth for everyone,” it truly seemed less like a performance and more like an invitation to code your own adventure.
— Sam Aaron @ MoogFest 2016 via Christopher R. Weingarten Rolling Stone Magazine

Music. Code. Art. Sonic Pi is all of these. 

Sonic Pi. What is it? Where can you get it? What can you do with it in your class?

Get it here: Sonic-pi.net

Sonic Pi allows you to make music with code. It's a seriously simple peice of software (to begin with) that allows you to program loops and samples all in time with one another. It also allows you to keep things simple by emulating musical scales either with midi or regular notation. The way you expeirience it should not be how we think about traditonal instruments it's way beyond a single instrument with a single range of sounds. You pick up a guitar and you pluck the strings, then you press down on the frets and the length of the string that you re-tune defines the sound that comes from the strings. This is something you can do in Sonic Pi however Sonic Pi goes way beyond this.

In a nutshell, you can mix samples, live mix samples, splice sounds, edit them, bend them, break them and reattach all while keeping each 'Live Loop' in sync. This is the big deal: it's all in sync whether you are using a BPM counter or the rhythm of the sample you're using. And, if you're making music on a Raspberry Pi then you can pretty much make an accompanying video in Minecraft. Amazing.

The session I'll be leading at Fobit 2017 is an introduction to what is possible using text to code. Sadly, we were not able to get Sam Aaron himself (@SamAaron/ @Sonic_Pi) the creator of Sonic Pi over or his counterpart who I saw live demonstrating at Bath Ruby, Xavier Riley (@XavierRiley). Alas, we tried! Even so, we have people here who are ready to run additional workshops, Sam's write-up in MagPi Sonic Pi Special Edition and attendees to produce fine, fine tunes and compete too.

The main reason I like this is that Sam and his team specifically laid out the vision for Sonic Pi that if an addition to the application was beyond the understanding of a ten year old child then it was not to be added. As a tech integrator in the primary school this is, quite literally, music to my ears. We have been after a text-based language to peel our kids away from Scratch as I feel we use Scratch to death. I also feel that there is a lot of learning that takes place in coding that really has no real goal attached and Scratch can fall into that category pretty easily. Where as Sonic Pi doesn't. In order for Sonic Pi to be successful there needs to be an instructor present to guide students towards their goal. Scratch can be a little wishy-washy at times unless there is a very specfic goal such as producing game or animation (minus that Cat or its ilk!).

So what can we do with Sonic Pi? 

The beauty of Sonic Pi too is that within the application there is jargon-less support and tutorials all the way through. Heck, while I was running the session for FOBIT, Tine Pendred from Garden International School, KL tweeted Sam with praise and for support. He tweeted back with directions on which tutorial she needed to sync buffers! Now you don't get that kind of support from a lot of app support.

This session was by no means a masterclass and, when you are being watched while typing, it's rather off putting to the point where I forgot a load of syntax and my code didn't play. The competition got people motivated and the chance to win a Rapsberry Pi 3 meant people took this seriously with great results. Well to Tine who won the Pi in the end - well deserved.

The session was meant to inspire and allow teachers to take on the notion that text based programming languages are 'scary' and that we can't do it. Or, that students can't tackle text programming for similar reasons. Sonic Pi is based on a langauge called Ruby. It's a fully fledged programming language however, as you will see in Xavier's walkthrough below the accessibility of Sonic Pi is really quite low. What you do with it afterwards is where you truly become enconsed in wanting to learn more. Once you get over that hurdle of "whet the hell do I write next?" the music spurs you on and as Xavier jokes below - it's all about mood, your wants and deisres. The music pushes you, and as I said earlier about Scratch being somwhat goal-less at times, Sonic Pi drives you to create your own goals. Once you have a play, hit up a few live loops you will soon be wanting to re-create wel known tracks such as this Daft Punk re-make. If anyone wants to help me get my fix on the Out Run sound track please feel free to drop me a line.

Several people from the conference have taken this on where students are using soundtrap to collaborate and build their musical creations from there. You can hop on over here to see what Jonathan Kitchin is doing with with his classes and their soundtrap project.

Below are a few of the links I posted out including some very basic level intros from a guy named Dave Conservatoire, the most amazing Bath Ruby set and walkthrough by Xavier Riley and, finally a live set by Sam at the bottom.

Enjoy.

This video is part of a course introducing Sonic Pi (www.sonic-pi.net) to musicians. You can view the whole course in order and watch many more videos at www.daveconservatoire.org
Rocking Out In Ruby - A Playful Introduction to Sonic PI by Xavier Riley Help us caption & translate this video! http://amara.org/v/IG11/

Live Coding with Sonic Pi For more recent performances see: http://livecoding.tv/samaaron

via: http://www.binaryfestival.com/blog/introducing-sam-aaron