Home Gotopia Articles Sam Aaron’s Soni...

Sam Aaron’s Sonic Pi Can Help You Make Music Through Code

Unleash your creativity with Sam Aaron's Sonic Pi! This user-friendly tool lets you code and create music simultaneously. Start composing your own tunes!

Share on:
linkedin facebook

Read further

It's not everyday that developers and programmers get you featured in Rolling Stone. But Sam Aaron was one. He created Sonic Pi – a live coding language for making music – decades ago and it has grown substantially where it’s been downloaded by millions across the world. The open-source, free-to-use project is now also financially assisted through a Patreon campaign and Sam has been spreading the word about Sonic Pi through schools, conferences and workshops. It is well worth watching one of Sam Aaron's live coding performances on YouTube for a demonstration of how creative and adaptive Sonic Pi can let you be. 

The main motivation for Sam has been to make coding easier for children as well as make computer science a creative form of expression. If you haven't yet learned to code, can code but haven't learned to make music, or just want to experience the creative power of code, Sonic Pi is for you. One of the ways it can be used is when modifying code it can also modify the Minecraft world live and then combining sounds with it to make a full audio-visual experience.

GOTO conferences sat down with Sam to pique his brain about coding, creativity, music and his mission with Sonic Pi

Sam Aaron at GOTO

You started your journey with GOTO as crew many years ago in Aarhus and returned as a speaker years later. How did that journey happen?

I was doing a PhD in computer science focusing on the design of Domain Specific Languages at Newcastle University around two decades ago. It led me to start a Ruby user group so I could facilitate discussions on the subject among the ones working with Ruby. It was that year that GOTO Conferences (then JAOO) announced an event with a Ruby focus. Someone from their end discovered me because I was running this Ruby user group in Newcastle, and sent me an email saying, “Hey, we've got this really cool conference. It's got some high-profile Ruby people, maybe you want to go”. I remember looking at the price tag and sent back a cheeky email saying “sounds great but I have been wearing the same shoes for three years because I'm a student and I can't afford a thing. You don't happen to have any free tickets?” I expected nothing back. However, I heard back from them saying that if I went as one of the crew, I could get into the conference for free.

I did that for three years in a row. I made connections that are still solid and helpful to me. That’s the magic of these conferences. It was serendipity in the sense.

How did you get the idea of Sonic Pi? 

Programming was already exciting but I wanted more. I thought, what if I could apply these ideas about programming languages to music? I quickly discovered that this has been done for many years. One of the earliest ideas about computer science was using it for arts and music even before computers existed. Ada Lovelace, in her diary, talks about these machines which were just the number of computations that could be potentially used to make music of our dreams. 

It was just an idea until I was at an after-party by GOTO and they got a band of programmers to perform. I remember thinking, “what would it be like if we could programme the music?” – a naive thought and it sent me off on this journey. I  then started exploring that in my own time, building my own tools initially using the Ruby programming language. 

Before Sonic Pi, I built a system called Overtone – a live coding language built in Clojure – along with a friend, Jeff Rose where you could create music using code and it's just one of many at the time. I started using that system to perform at conferences, including GOTO. While it was doing really well, no one else could use this system. The amount of effort it took to make something interesting was huge. Most people didn't want to give that time – it was just too hard. But soon after, I moved to work at the University of Cambridge and it just so happened that their focus was on children and teaching them computer science.

There was a small amount of money offered by Cambridge Uni for anyone who could build software to teach children how to code on the Raspberry Pi and without a doubt I took the opportunity. Overtone wasn’t designed for speed for the low power of the Raspberry Pi so I switched to Ruby, which performed well enough on the hardware. I built it in a way that it would be easy to port to Windows and Mac OS as well. 

It continued to get funding for a few more years given how successful it was but it all soon dried up. That’s when I ramped up giving talks at conferences so I could fund Sonic Pi. I hope to find ways to sustainably fund it through giving talks, performances and workshops. Mainly because I want Sonic Pi to be free to use for anyone. 

Sam Aaron 2018

More schools are making it easier for kids to learn how to code. What will the role of software like Sonic Pi be?

The original Sonic Pi project was to build some software that could help teach computer science. However, in the UK, schools introduced a new computing curriculum focused on teaching children how to program and control the number of computers encompassing algorithms and data structures. I designed the lessons in a way 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.

I worked very closely with teachers to nail the issue of teaching children to code. The real problem I discovered, isn't the content and computer science as a subject but it's the method of delivery and the means with which a teacher can engage the students with the content. The question was, how do we engage kids in computer science? It turned out that music is a great tool for engagement that works across genders and cultures. 

What new innovations and features are you working on?

It's important to me that the tools I create be as beneficial to as many people as possible. I don't see the point in making something that just benefits me. By making Sonic Pi free, it opens up the audience to anyone with a computer.

The free open-source nature of Sonic Pi has fabulous benefits in that it is the foundation for a friendly community of people sharing and contributing new ideas. Many of the new features in Sonic Pi have been contributed by other developers for free because they want to help. Sonic Pi even has a core team of volunteer developers who work together to keep the software fresh and powerful.

I am working on a feature that enables users to code visuals alongside music and while that's already there, it’s now a case of plumbing it and linking these things together.

How the technology exactly work? 

Sonic Pi

Sonic Pi is used to do live coding. Live coding is the act of programming as a performance. Typically, this means that live coders are coding in front of an audience while creating music.

Sonic Pi makes it very easy for anybody to live code music. It provides a tool called the Live Loop, a loop which can be changed whilst it's running. Sonic Pi's Live Loops are inherently concurrent, which means you can have many running at once just like you might have many members of a band—one playing drums, the other bass, and another driving some ephemeral synth leads.

To perform with Sonic Pi, you just need to write one or two Live Loops and then hit the Run button to start them off. You're then free to modify one or all of them, and the next time you hit Run the changes will kick in. Write code, hit run, write code, hit run, that's all there is to it.

Sonic Pi's core is a live coding system that contains a strong timing model. Sound is just one of many applications of this system. For example, you can already live code Minecraft Pi Edition from Sonic Pi on your Raspberry Pi.

It's not too hard to imagine extensions to Sonic Pi that could control DMX lighting rigs, robots, visualizations, to name a few. The exciting thing is that the readers out there will have better ideas than me, and Sonic Pi allows them to make their ideas real.

Any examples of how it’s being used? 

There’s one artist called DJ Dave based in the USA. She's performing in huge venues and she’s using Sonic Pi. When people go to see her perform, they’re not seeing a professional coder who is going to just talk about business systems, security or architecture. She projects her code for the audience to see what she's writing in real time. To me, that's a much more exciting and effective way of motivating the next generation in schools to explore and see technology – particularly programming as something that's for them. 

There's also someone in Canada who made a whole opera.

What was your motive for Sonic Pi?

I believe that programming is just as important as reading and writing for human creativity and expression. Sonic Pi jumps straight to that creativity in the simplest possible way—so simple that a 10-year-old can do it and they do.

There is a myth in the software world that you can't build something that's complex, and yet simple to use. People would say to me ‘you can't build something for 10-year-old kids that's also going to be used by professional musicians or professional programmers.’ Well, what is a guitar? Anyone can learn how to plug a guitar but yet it's still sophisticated enough that professionals will use it. Same goes for Sonic Pi. 

It's easy to come up with new features and new ideas but it's really hard to find ideas that you can actually go to a classroom and teach your 10-year-old child. It's really about finding that balance of what's a really cool thing for human expression that professional artists would like to use and how do I package that in a way that children can work with effectively.

Sam Aaron on stage

If you change one thing in the tech industry, what would it be?

There are tonnes of world-changing softwares that could have the same global impact as Sonic Pi but aren't allowed to exist because there isn't the funding or the organizational structure to actually enable it. It needs a weirdo like me, who's got a vision, doesn't want to stop and forces themselves to continue to work against all of the odds to make it possible. There needs to be more software that doesn't have a business model but still has massive human value but sadly it isn’t the case. 

What is the key challenge with Sonic Pi?

The main thing is funding the project. I remember I had a conversation with a bank, trying to get an account for the company. That was the most difficult conversation I've had because they went, “What is your business model?” I didn't really have one and that didn't wash down with them. They wanted me to say ‘I'm buying X amount of apples and I'm selling 100 apples a day and I'm hoping to sell 500 next year.’ To their surprise, I said I'm making software and giving it away for free. Mainly because keeping it free, for me is really important because it allows more people to engage. 

Apart from maintaining it, the biggest amount of work isn't actually deploying new features. It's actually getting the thing to run well on all the different computers in the world. Different schools have got distinct Microsoft policies and it doesn't work on all.

Where do you see Sonic Pi in the near future?

I see the company as a vehicle to work within the current capitalist environment. It's a system that allows people to give me resources, so it'd be lovely to be able to survive for another four years. Ideally, what will be best is I didn't have to worry so much about money. 

You can try creating some jams by simply heading over to the Sonic Pi website. If you like what he’s doing, consider donating to his Patreon.   

Catch Sam at GOTO Aarhus in May 2023

Sam Aaron, founder of Sonic Pi

Check out Sam's talk about Sonic Pi at GOTO Copenhagen 2018