Some programmers think their code is music to the ears - for Sam Aaron, it is! Sonic Pi is a tool for coding music, and it's written in a way that it's very forgiving to newcomers. It uses a Ruby-like syntax, and Ruby has a tendency to read like English and be forgiving with formatting (unlike Python), which in theory makes it easier for children to pick up.
He originally started working on it in 2012, to help students in the UK learn computer programming. Anytime I've read or watched an interview (like this one), he seems genuinely enthusiastic about the possibilities it holds, for teaching the benefits of knowing at least basic programming, as well as for building an enthusiasm for music.
Sonic Pi was originally created to help engage school children with this new subject. I worked very closely with teachers to develop Sonic Pi whilst creating lesson plans that taught bass lines and riffs rather than lists and functions. It just so happens that in order to make music with Sonic Pi, you have to learn to code.
Incredible in its simplicity
Here's a quick sample. It plays 2 frequencies and an electric "blup" sound, with a short pause between each, and performs it all 3 times. With a minute of instruction, any child could tell what this is doing and start changing it to try new things.
3.times do play 50 sleep 0.5 sample :elec_blup sleep 0.5 play 62 sleep 0.25 end
One of the cooler features of it is that you don't need to wait for the code to compile to try it. You can run a complex sound in a loop, change it on the fly, and listen to your changes immediately, which he refers to as "live coding". I saw some of this in action at a conference a few years ago, and there's plenty of examples on Sam's YouTube channel.
To be fair, anytime someone's coding in front of an audience, whether a conference or streaming on Twitch or YouTube, I'd call it live coding. It's just that much cooler if your code happens to produce a great beat too!
Try it yourself!
Amazingly, every bit of it is free, which is absolutely incredible. So much work, so much time put into it, at no cost. There is a patreon page though, for those interested in supporting his work. Seriously, it's gotta be a fulltime job.
You can learn more about why he chose Ruby to create it in (flexibility when teaching kids), the advanced concepts it can teach (like concurrency), and how it supports what he calls "live coding".
And if you want to see someone really having fun with it... 😏
This isn't the first time I've used it or written about it, so if you'd like to see it used a little more depth, check these out: