Sonic Pi: coding tunes in the classroom
A new study from the University of Cambridge has found that making music in classrooms using computer coding could revolutionise the teaching of both subjects. Teenagers have been trying out a system called Sonic Pi. This uses the SAME coding techniques to create tunes that professional computer programmers use to make websites.
Graihagh Jackson went to the Sonic Pi Summit - a meeting of teachers, music makers and programmers - to meet Sonic Pi inventor Sam Aaron...
Sam - One of the things that we're learning as society is the importance of programming for creating new ways of interacting with the world around us. And that can help support the current activities to make them more efficient, but it can also give us new possibilities and new ways to express ourselves.
Graihagh - Tell me what you initially set out to do.
Sam - So, I built Sonic Pi to make it easier to get a creative engagement with programming. I build a very simple system which allowed you to make simple beeps and to time the beeps and the changing sound of the beeps. But through that, we're able to teach fundamentals of programming. So, we're able to teach iteration - so, it's doing things a number of times like 5 times or you can teach basic conditional - so, if this is the case then do that. Otherwise, do something else. Now, all these things are really valuable for creating music but also, they're all fundamental computing constructs. So, we're actually sneaking in some computing while also learning how to do music.
Graihagh - I was going to say, is there something that you actually use in coding rather than just it being a nice fancy gimmick to involve creativity in coding?
Sam - Absolutely. I mean, the fancy gimmick is just a way of sneaking in the programming. What they're actually using is a professional programming language to do all the stuff in. And so, the skills they're learning to make the music are skills which are absolutely applicable in the industry, which is quite exciting.
Graihagh - Can we have a play?
Sam - Absolutely. So here, I've got a very basic - what I call a live loop. In that loop, we're just playing the note 50 and skipping for a second. So, if I started off...(sound) you should hear it. It's just beeping like that now. What we'd like it to do, is it too low, is it the wrong kind of sound, is it going too slowly?
Graihagh - A little bit slowly I think for my taste.
Sam - You want to make it go a bit faster? So, to make it go faster, well, if we're sleeping for one second between each note, so, shall we down to half?
Graihagh - Why not?
Sam - So, if we put in half there and I re-evaluate the code, you could hear it now going faster. Another thing we could do is that note might be a bit too long. So, we could reduce the length of the note. So, we can use what's called an envelope to reduce the amount of time that that note lasts for. So, if I put, release 0.1 second, we hear it's going very short. This is a very bassy note so maybe we want to take it up a couple of octaves. It's quite nice, but maybe you want to add some reverb and have echo going. I can change the phase duration of the echo and then that's the same note every time. So, maybe we want to choose random notes. So, we choose note from chords E3 or E2 minor. It's a bit too low as an octave so maybe we go up to...(sound) make it go faster...get rid of the echo. And then we can start playing our different synthesizers. So, that's a basic beep sound. How about a soul wave... or a profit wave? (sound) That sounds nice in different cut-offs...(sound)
Graihagh - So I should add, you are literally just typing very simple...
Sam - How many lines? This is 9 lines.
Graihagh - Nine lines but not very much at all and it's very much what I imagined, as a non-computing coding person, what it would look like on a backend of a website or an app.
Sam - Exactly, how it is. It's the same kind of code. Ruby's actually used often has been used quite a lot recently to make websites with. It's the same language you might write your business logic in. Here, I'm using to write and configure synthesizers and effects.
Graihagh - What struck me was that it was a lovely fusion of disciplines, something that is often missing from the classroom when the days are divided by the hour with maths in first period, art in second. What I was keen to know though was, could you actually create a half decent song using Sonic Pi.
Skuulleyes - Hello. I am Skulleyes from Swoomptheeng and we are one of the artists who is invited to create music video for the Sonic Pi project.
Graihagh - What's the track that you're playing here today?
Skuulleyes - The track is called In Thread. (music)...
Graihagh - So, you can create music but can you learn to code with Sonic Pi? Is it more than just a gimmick? Could children go on to build their own websites or apps, having played around with Sam's creation? Pam Burnard from the Faculty of Education at Cambridge, whose research from Sonic Pi was released just this week.
Pam - We found that young people learn differently. They work differently, they think differently, and engage differently when they're coding. I've taught in classrooms in secondary schools, in primary schools for 15 years and I've not seen the nature of this engagement. It's an engagement with a technology that is not about playing the outside of something, but actually, programming from the inside.
Graihagh - But is this just more than a bit of fun? What are students actually coming away with?
Pam - I think this is sort of the whole contemporary aspect of being able to code and control as a young digital learner, this is very comfortable for them, though there are risks. The risk being that their code crashes.
Graihagh - What do we mean by risk and is that necessarily a good thing?
Pam - The risk taking actually launched them into a different space, a learning space where to take risks meant that they're actually being created. They were problem solving out of crashes with codes. These code crashes like sort of car crash. It's pretty exciting and then to kind of solve the problem and to be able to perform on is one of the big things it was doing. That's why one of findings is that it engages in diverse and new learning pathways.