[00:00:05] SY: Welcome to the CodeNewbie Podcast where we talk to people on their coding journey in hopes of helping you on yours. I’m your host, Saron. And today, we’re talking about how you can use music to learn code with Sam Aaron, Creator of Sonic Pi.
[00:00:19] SA: Instead of teaching data structures, we taught base scripts. And instead of teaching iteration, we taught sort of melodies, which repeated.
[00:00:26] SY: If you have a question for Sam after listening, don’t miss the Ask Me Anything Session he’s hosting on the CodeNewbie Community Forum. Just head to community.codenewbie.org and you’ll find his threat on our homepage and he’ll answer you directly in the comments. That’s community.codenewbie.org. In this episode, Sam talks about how programming basic games on calculators helped him learn to code, developing a passion for combining music and code and creating Sonic Pi after this.
[MUSIC BREAK]
[00:01:08] SY: Thanks so much for being here.
[00:01:10] SA: Hi there.
[00:01:10] SY: So Sam, I’ve heard about you for many years. I am very embarrassed that I have not had you on the show yet. I’m very excited that you are here. I think your work is really, really awesome. So thank you so much for being here.
[00:01:22] SA: Oh, thank you.
[00:01:22] SY: Before we talk about the music and the code, let’s dig into you a little bit. Tell me how you got interested in coding.
[00:01:27] SA: I think I’m always interested in languages in general and reading and writing. And when I was younger, my parents bought me a Spectrum 48K. So it was a small computer, which plugged into the television, had little rubber keys, obviously to play games, that was my main interest, on these little cassettes. But even to load a game up, you have to write a single line of basic code. The computer also came with a little manual, which taught you how to program in basic. So that was really the first port of call was playing with this thing. And what was fun were the magazines you used to get used to have little interviews of people who made games and who were doing interesting programming things, but they also included a lot of code in the back, which you could painstakingly copy into the spectrum, and obviously, it would never work. But my introduction was through playing games, coding games, and having fun with this little small computer, which plugged into the television.
[00:02:17] SY: What were some of the little games that you were coding at the time? What were they like?
[00:02:20] SA: At the time, yes, what was fun I think and interesting and so far from today is that the games you could program, the ones which are in the back of the magazines, weren’t actually that dissimilar from the games that you would buy in the shops. Because obviously now you have games which are like film productions, which have multimillion dollar productions, but back then a single person would be creating the coolest, most exciting games. So it’d be very simple things, like icons moving around, shooting each other, or little mazes. But when I was doing my own programming, I mean, I either was copying the code from the magazines, but actually the code I wrote myself was just drawing basic pictures and making basic melodies and just being able to have an idea in my head and be able to sort of recreate it through the code.
[00:03:04] SY: And what age are we talking about at this point? How old are you?
[00:03:07] SA: Oh, that’s a good question. I think about seven.
[00:03:09] SY: Wow! All right! You got an early start.
[00:03:12] SA: Yeah. I mean, it was all very simple things, so nothing sophisticated.
[00:03:15] SY: Right.
[00:03:16] SA: It was a lot of fun. And I really enjoyed sitting in my room, just typing away and seeing the screen and come to life with the sort of the actions of my code.
[00:03:25] SY: What was the experience of coding like for you at that time? These days with coding, we have an online community, many online communities. We’ve got Stack Overflow. We’ve got Google. We’ve got so many different resources that can help us kind of figure things out along the way. When you were writing your own code and when you were trying to figure out how to build these programs, what was that experience like?
[00:03:46] SA: It was quite isolating because I didn’t know any other people doing this. It was only the magazines you can get from the shops. None of my family were programmers. So it wasn’t people to talk to. There certainly wasn’t a community that I could call to, to ask questions. So that was a negative, I guess, from when you can compare it to today. But there was a massive positive, which was that the barrier to entry was so low that even a small child on their own with no support could get started and do fun things that were actually meaningful to them. I guess I wasn’t really worrying about what the compiler was doing or whether this library was working or trying to get the JavaScript, get whatever thing to do the right thing, which I think most of my day-to-day programming is really sort of fighting configuration and just getting the build to work. There’s none of that because you just had a basic interpreter and you just wrote your code and it just evaluated. So I think you were much closer to the programming semantics and ultimately the observation of your creative results, that turnaround was much faster than it is with the majority of programs today. So I think that experience, I think that was probably what hooked me as a child and kept me going.
[00:04:57] SY: So let’s fast forward some years and let’s get to college. What happened in college? Did you end up pursuing computer science?
[00:05:04] SA: That’s a good question. If it’s okay, I could maybe skip back maybe sort of four or five years.
[00:05:09] SY: Sure.
[00:05:09] SA: Because at point in college, I had already decided that I was going to be a programmer. And when I arrived at college, I already could program fairly well. And I was quite pleased that the things they were teaching me I just sort of taught by myself, but it wasn’t actually through the spectrum computer really that I really got to grips with sort of a deeper understanding of programming. It was with a graphical calculator in my math class.
[00:05:30] SY: Oh, okay. Yup. Yup.
[00:05:31] SA: So I wasn’t that super engaged with the math stuff going on, but this fancy calculator, it had all these buttons and a little screen and it had a little sort of, I think, it was actually 50 by 50 pixels, you can color them in individually, the pixels, blue, orange, or black, I think it was. I think obviously, it was designed to draw signwaves and tangents and curves and calculating the area under the curves and things. But I soon found out that you had also an access to a simple kind of basic language. And I did all my programming experience there, teaching myself how to code quite fun games.
[00:06:05] SY: Wow!
[00:06:06] SA: And I had like Tetris and I had a Pac-Man clone and I had Tanks for each other and a text adventure game with puzzles to solve and rooms to move in and out of, and yeah, all painstakingly programmed in with like keys, which were just numeric. They’re one to nine, like an old school phone.
[00:06:22] SY: Yeah. So was that what made you go, “Man, I really want to keep doing this and I want to end up doing this professionally”? Did you even know you could do it professionally when you’re just coding on a calculator?
[00:06:32] SA: Well, so the other fun thing is you talked about communities right at the start. Well, this was the point where I was a teenager at this point. And in our school, we had this amazing thing. One of the computers got connected to this thing called the internet. And it was just mind-blowing. And I remember standing in front of this computer and had this web search thing called AltaVista, and obviously like the Google of today. And it asked you a question of what would you like to search about, like literally anything. So the first thing I searched about was calculator games and found a few, but mine were much more interesting, I thought. So I was like, “Okay, I’m actually pretty good at this.” And I had no idea at that point because, again, I was isolated and I was on my own. I was the only person I knew that was actually programming these calculator games. So yeah, that was really what made me realize, actually this is something to pursue and maybe I could unlock the creative potential of code by going to university and getting a job that way.
[00:07:27] SY: So you get to a university, you’re doing the computer science degree, you know more than your peers, it sounds like. You kind of know what you’re doing.
[00:07:34] SA: Some of them mostly, some, yeah. I think it was a wide berth of people who came with no knowledge and some with actually much more expertise who had families or friends who are really deep programmers. So they definitely not by far the best at all.
[00:07:49] SY: What was college like for you? Did you decide what kind of career you wanted within programming during that time?
[00:07:55] SA: Yeah. I mean, so university for me was much more of an exploration of the self. It was the first time I could meet people that I could find to be interesting for my own reasons. Whereas at school, you just put into a small class of 30 people and it was assumed you become good friends. And of course, you’ve made some good friends, but it was just through sheer will of being with those people for five years. Whereas at university, there were thousands of people to potentially meet. And so it was much more of an exploration of finding out who was interesting, who to hang out with and learning to socialize there, learning to cook. Those are much more of life impact things. And joining the societies, I joined the walking society and went walking in the mountains and hills pretty much every weekend, which is amazing.
[00:08:41] SY: Wow! That’s cool.
[00:08:43] SA: But in terms of my career, I felt really frustrated by it. It wasn’t as fun as the calculator. And yeah. So that actually turned me off quite a bit. And also, I’m generally pretty poor at following the curriculum and doing things on time. So I kind of really struggled in a way and I remember my dissertation, which is like the final sort of third-year project. Other people had handed theirs in before I was at stone mines. I was doing quite a stretch and I crunched it out, but ultimately I did actually really well and got top marks. And so that was like really fortunate. So I obviously had found something I was naturally good at. But instead of thinking about careers, what happened was I was just handed a plate with a sort of a golden ticket to do a PhD straight away, which is what I did.
[00:09:29] SY: So when did music come into coding? When did that intersection happen?
[00:09:35] SA: The first intersection of code and music was way back when I started off with a Spectrum 48K because there was a command, I think it was called “BEEP”, that you can write the word BEEP and choose a note and it would go, “Beep!” And then you could wait some time and you can make another beep. And so I was able to make simple melodies with that. Of course, then with a calculator that had no sound functionality and also the university course didn’t cover sound in the slightest. So that was all forgotten until much later on. I did my PhD. I got invited to go to this conference because I was running a user group at the university or the city of the university. The tickets were crazy expensive. So I said to reply back saying, “I don’t think you have any free tickets for poor PhD students.” And they actually replied saying, “If you come and help out, you can come in for free.” So I went to this conference in Denmark, which was super cool. And they had a party afterwards, which was kind of a mega band of all the programmers, all the speakers and things who could play instruments. And that was pretty fun. And I remember watching that thinking, “Wouldn’t it be cool to be able to code the music? Surely at a technical conference, that would be a much more sort of fitting approach to the party.” I thought that obviously was that wouldn’t be too much work and obviously sort of 15 years later, I’m still figuring out how to do that. But that was the opening question. At that point, then I started to do research into what people are doing in this space. And of course, there’s a vast wealth of people doing really interesting things from even as far back as the ’50s where Max Mathews would be programming these big, massive computers to make basic melodies. And even Ada Lovelace was dreaming about the mechanical machines that she was designing with Babbage, but how they could produce music of people’s dreams. So yeah, this was nothing new. And so I was able to sort of tap into a vast wealth of previous work and really bootstrap my ideas in interesting ways.
[00:11:27] SY: And were these experiments just for fun? Did you have plans to try and combine them in a professional manner?
[00:11:33] SA: Oh, well, no. I mean, it was definitely fun and definitely a deep passion of mine. And I remember actually at the time I was a professional programmer in Amsterdam, I don’t know those sort of manager meetings, those sort of, what they call, like a window thing where you’re looking at the past, present, and future of your career. My manager has sort of asked me, “What would you imagine yourself doing in five years? What do you like to do?” I remember saying, “I’d love to be back in sort of a research setting where I will be designing my own programming language for music.” And my manager kind of like spatters coffee out everywhere, laughter. Well, I did that, but it was more of a dream, definitely a dream, and clearly an outrageous dream and still is today an outrageous dream, and somehow it’s still managing to carry on, but it’s definitely been an extremely tricky road to walk.
[00:12:26] SY: Well, some of that dream seems to have been realized through the creation of Sonic Pi. Tell us what is Sonic Pi.
[00:12:33] SA: It’s a tool. It’s a programming language. It’s an environment. It’s an app. So you download it, it’s free, and it opens up. It’s like an integrated development environment, kind of like IntelliJ or EMACS or any of these coding environments. And you write code, you press the button that says play. And if your code is correct, it will make you some music. And then you can change the code and can change the music. And you can sort of compose your own music by writing code.
[00:13:00] SY: That’s so cool.
[00:13:00] SA: What’s more interesting for me as well is that not only can you compose music. You can also perform music. So whilst the music’s playing, you can modify the code and it will modify the music too. So you can keep it changing as it’s playing and you don’t have to stop it ever. You can keep it going forever.
[00:13:17] SY: So how did your love and interest in combining music and code? How did that lead up to Sonic Pi? What was the start of Sonic Pi? Tell us about that.
[00:13:26] SA: Yeah. So after this party, I started doing the research and I discovered a programming language called SuperCollider, which is an open source environment, which does exactly what I’m describing. And so I started to delve into that, but it was really too low level for the space I wanted to be. It was much more about sound design. What the basic physics are and the maths that describe sounds and how you can use that maths to then design your own sounds and to work with it. You can work at a high level as well, but it was very much you couldn’t just make it sound. You had to design your own sound first. And also I at the time was deeply interested, because of my programming language background, in lisps and in sort of various expressive languages. And so I was interested in seeing if I could figure out a way to combine lisps, and I was interested in the language called Clojure at the time, which was a lisp by the JVM with the SuperCollider system. And I was toying this idea, and I was speaking to a friend about this. And he said, “Oh, I met this guy called Jeff Rose. He was also in Amsterdam. So he’s just started a project called Overtone. And that combines SuperCollider with Clojure. So I was like super lucky.
[00:14:29] SY: All right!
[00:14:31] SA: And so he was a month into that project and I just made instant friends with him. And we worked together on that for a few years. And that was really the starting point to where I actually really learned how to design sounds with code and design languages for code and languages for music with code, and to play around with that. That was the point where I had that meeting with my manager. I was already working with Overtone at that point and that was clearly something I wanted to do spend more time with. I was obviously frustrated with the fact that most of my time was spent building business apps and really I wanted to build this weird coding system for music. Then at that point, my wife got an amazing opportunity to do a scholarship at the University of Cambridge. And so we moved from Amsterdam to Cambridge. And so I managed to somehow convince her that I was going to take a year out because I never really had this. Lots of people took a year out between school and university where they travel the world and do cool stuff. And I never did that. And I didn’t take a year out after my PhD. I went straight into a job. And so I convinced her that it was a good idea for me to do this year out. And I was going to spend a year working on this Overtone system and then apply for jobs after I’ve finished. And somehow in that year, I was chatting to people at the university who were doing music tech things. And I ended up finding a way to get a desk at the University of Cambridge Computer Laboratory. They just said, “Your work is interesting. Come and sit here. You can spend time with us.” Obviously completely unpaid and just a space to work. But that turned out to open up really interesting opportunities. One of them was the fact that I was sitting at that desk when the Raspberry Pi computer span out to the computer labs and that had been wildly successful as hardware, but they were really struggling to find interesting software that would engage children in coding, which is really at the beginning, certainly, was a charitable mission was to teach children how to code. And so I remember it was that point where my funding had all run out. I was about to go back and be a professional programmer again. And this sort of three months’ project sort of was waving around and I said, “Oh, maybe I could test some of my Overtone ideas and simplify them in a way that children can work with and get that running on the Raspberry Pi.” So that was the start of Sonic Pi. The Pi comes from Raspberry Pi and Sonic obviously is from audio. And so that three-month project, I remember back then, it was funny because it was a three-month project. And I had that first meeting about the mission, the objectives of the project. And I thought they wanted me to, in three months, I thought it was a quite ambitious to try and create some kind of prototype system for teaching children how to code that runs on the Raspberry Pi. But in the meeting, they told me they didn’t want that. They wanted that and they wanted me to go to a school and find a teacher and design lesson plans and teach it and then evaluate all that work in three months.
[00:17:19] SY: Oh my goodness!
[00:17:20] SA: Yeah. It was a massive crunch down of work. And so I obviously couldn’t spend all my time designing and building. I had to do it really quickly and iterate. The first version of Sonic Pi took me two weeks to build. It was just the simplest thing I could possibly make. And it was basically exactly a copy of the Spectrum 48K basic beeping system. You could make a beep. You could wait some seconds and you can make another beep. And through that approach, you can make your own melodies. It sort of evolved from there, but the teacher, Carrie Anne Philbin, she was fabulous to work with. We sort of jammed together about the lessons. And every week, I would go to her school and support her teaching, this computer science lesson. And then I would go back, we’d discuss what worked, what didn’t work, and we discussed what we’re going to do next week. Then I’d have a week till we make the next version. So every week, there was a new version of the software to teach them to the next lesson. So it was definitely development sort of in the sort of a fire pit, working really, really closely with the students and that actually, for many reasons, it was a really rewarding and beautiful experience, which I think led to how usable and fun Sonic Pi actually is because it had to be something that children could immediately work with. And also the teachers who hadn’t necessarily got any programming backgrounds to lots of teachers teaching computer science don’t necessarily have. Whereas physics teachers have all done degrees in university, and math teachers have all done math degrees in university. A lot of computer science teachers haven’t done computer science degrees. So I had to be really, really friendly and I think lay the foundations for something quite exciting.
[MUSIC BREAK]
[00:19:14] SY: What were some of the challenges of building and testing Sonic Pi?
[00:19:19] SA: The main challenges were attempting to try and understand the constraints of a classroom. I was super surprised actually how little you can actually teach in an hour. So when you’ve already got a tiny amount, because of the teachers spending most of the time getting the children to listen. “Okay, stop moving on your chairs. Sit down. Stop talking. Stop looking at the window.”
[00:19:41] SY: Yeah.
[00:19:41] SA: But when you’ve somehow, if you have managed to get the children to focus on you, you’ve got a couple of sentences where they’ll listen to you before their minds are wandering again. So you have to be really, really focused on what you're trying to deliver. So that was a real shock to me. Because obviously most programming environments don’t really consider that. You have to spend weeks off to learning all the shortcuts or even how to start a project can be quite a large and complex task because it’s not necessarily designed for complete beginners. It’s designed for professionals and you expected to come to most of these tools with a degree of knowledge about programming. All you need to go away and learn that before you could actually get started. Whereas this tool was designed for people who couldn’t even type. That was a real interesting constraint. And so trying to figure out what was teachable, and also from a user perspective, often when you’re building a system and you pass it to testers, you might give them some constraints. You might say, “Okay, I’d like to focus on this bit to test, but don’t press that button. It doesn’t really work yet.” You can’t tell that to children because they will definitely press the button a hundred times.
[00:20:50] SY: Press all the buttons.
[00:20:51] SA: Yeah, exactly. So they would break it so often so quickly. And so designing it to be not just robust for normal users, but robust for meddling children who intended to break it, like they would try and make the volume 2,000 million opportunities.
[00:21:09] SY: Oh, boy!
[00:21:10] SA: Yeah, exactly. So building in a safety system for the audio was pretty critical pretty quickly, and building tools that so often they would make this whole system crash quite quickly. So building it in so they automatically saved all their work at every opportunity. So even if it did crash, you could reopen the software and it would have remembered what they last did. So things I hadn’t even considered as an introductory programmer became very quickly a really important thing is to focus on. Focusing on making things really approachable and easy turned out to be really valuable in a nightclub. So a lot of the features I built for just making it simple for the teacher could come up and have a look and debug a problem and when something went wrong for the student to be able to hopefully fix it quickly. A lot of those sort of design decisions I made to make that sort of workflow really simple and intuitive for beginners turned out to be really useful and are very sort of cognitively loaded situation, which would be me at two in the morning in a nightclub with lots of people watching me. So when things would go wrong, it needed to be super simple to fix. So actually, turned out a lot of the design decisions I made to make it simple in a classroom worked out really beautifully for a nightclub experience.
[00:22:23] SY: So besides teaching kids how to use the app itself and how to make music, what were some of the foundational things that it was teaching them?
[00:22:32] SA: The whole call to arms was because the UK government had worked very closely with an organization called CAS competing at schools and they delivered a new curriculum for computer science. So the idea was to teach computer science as a science not just teaching how to do spreadsheets and logo designs, but teaching the fundamentals of computer science. So algorithms and data structures. And so there was this computer science curriculum, which I was attempting to make sure that Sonic Pi was a good fit to teach. So that was really the main challenge was to see, “Can we actually teach the introductory computer science concepts, the core concepts with this tool?” And the answer is undeniably a big massive yes. And actually it was really, really fun, rewarding. Instead of teaching data structures, we taught base scripts. And instead of teaching iteration, we taught sort of melodies, which repeated. It was very simple and easy and intuitive to map on these concepts, which on their own, when we actually did lessons, in the early lessons, or we just tried to do a lesson on variables, for example. That lesson was just really didn’t wash well at all. People just didn’t understand it or get it. They’re like, “Okay, I’ve made my variable just in B, but equals 1. What do I do with it?” So well, today, that’s a variable. You can still think of it.
[00:23:54] SY: That’d be another lesson.
[00:23:56] SA: Exactly, that without it looking into something that was meaningful to them sort of was really tricky to teach it to the majority of people. Whereas the musical concepts were for the majority of the other students were actually interesting and valuable for them. And so they would learn the programming as a way to get to their musical results quicker and more effectively to the extent where they were really quickly asking concepts that were not on the curriculum, but were interesting to them such as multithreading. And they quickly wanted to make the baseline as same time as the drums, for example. And so that was really interesting to me and also really frustrating as well to deal with this sort of constraint where the teacher would say, “That sounds super interesting, Sam, and I can see the students are really interested in doing that, but it’s not on the curriculum. So I’m afraid we don’t have time or space to teach that.” And so I was interested to see if I could slip in these concepts into the system in ways that didn’t have to be explicitly taught. So they didn’t have to sort of take up valuable teaching time, but still could be accessible and usable by the children. So threading was something I snuck it in, and instead of doing loops in Sonic Pi, you do live loops, and they have a notion of concurrency built in. So you can have multiple live loops playing at the same time. And so students don’t even know that concurrency. It’s actually was much more intuitive. They were asking, “Why am I two loops not playing at the same time?” But of course, if they’re in sequence and the program is starting at the top and working its way down through the code gets to the first loop and just stays there forever. It never ever got to the second loop. So it was actually more confusing to them why multiple loops weren’t concurrents than having a concurrent system where by default they are. So I find that quite interesting.
[00:25:45] SY: That is interesting. Huh? Okay. So how much about music do you need to know to use Sonic Pi, either within the classroom that you’re talking about or just for the rest of us?
[00:25:58] SA: The answer is none. Absolutely none. And I think that’s what it’s designed in from the start. I mean, obviously the system was designed to teach computer science, not music. So it would be a bad start if for your computer science sort of introduction, you had to have understood some music theory. That would never really go with that. For the approach that Sonic Pi was taking, which is to teach computer science would never really a proposition. But also I get really frustrated by systems are really required to have a ton of knowledge and experience and formal knowledge particularly before you can even get started. And also socially and in society, it’s frustrating to hear so many people. I always saw a ton of me, people were saying, “Well, I’m not a musician. So there’s no way I could do this.” And it’s like, “Well, if you’re going to say, you’re not a professional musician, I’ll agree with you there. But all humans, all humans are musical.” And if you can tap your hand on a table or hum a melody or move your arms, the dance, then they’re all musical acts. And whether or not you call that professional, that’s a different matter. But I think people really can express themselves through sound. Even speaking is a form of music in that way. And there were some studies that I looked at the past of the originations of language. And there were ideas that music came before speech. So I think it’s deeply ingrained in society. So dealing with that and so having to say, “You need to understand what a C major pentatonic minor chord with quaver, crotchet semitones is I found, yeah, something that you don’t need to know. Of course, if you do know those things and they were Western things, then that can help you. But another I think opportunity of code is that we were able to break out of these hardcoded Western traditions of score and notation that you might sort of directly sort of correlate to Beethoven and Bach and Mozart, which are beautiful things. But we’ve moved on in many ways or not on, but away from, and made sidesteps. And so music is much more than that. It is that and much more, but a lot of this other kind of music that we’re listening to, especially sort of EDM, interesting experimental electronic music, there’s no notation for. And so I think Sonic Pi and coding systems like Sonic Pi can start to offer off of that notation. And again, I think that’s really interesting is that you shouldn’t have to have experience of formal notation and that can actually be really restrictive as much more exciting to be able to say, “Let’s play the notes between notes and let’s play timing systems that aren’t timing systems.” In fact, there are lots of modern composers, which have been struggling to fight against the constraints of Western notation and figuring out how to do interesting compositions, where the notations are squiggly lines or the timings are really, really exotic and interesting. Steve Reich was a famous composer who is interested in doing repeating melodies where two people would play the same ditty on a violin, but slightly different tempos, which would be incredibly difficult to score and play. But actually it turns to looking at code, actually really trivial to code those things.
[00:29:08] SY: Tell me about some of the implementations of Sonic Pi. What kinds of things that people done with it?
[00:29:13] SA: So a whole range of things I’ve seen them. We have a really wonderful and lively community called “In-Thread”. In-Thread is sort of the syntactical word for creating a thread, which is kind of a new musician that you would create to play a musical piece, and in addition to other musical pieces at the same time. And so there’s people sharing music there all the time. And I’ve seen a whole range from people coding operas, to people coding heavy metal music, to people coding traditional Turkish styles of music, Indian music, and people coding and singing or people coding and playing in the accordion. And also, yeah, of course, much more traditional coding context, which is of techno nightclub music, because obviously that’s a lot of repetition and that’s easy to code, people doing all sorts of interesting things at nightclubs. Yeah. It’s just been wild to see the range of results. I remember there was a Finnish organization, which sends a bus to the continent of Africa and traveled, I think that was like 12 different countries there and taught over 2,000 predominantly women how to code using Sonic Pi. And I remember that when they announced this, I was a bit scared because really there is quite a lot of Western stuff baked in and it really is like quite focused on the kinds of weird music that I like to make. So I was wondering whether or not it would actually cross a cultural boundaries and work for people who have a very different perspective of music. And I was really happily surprised to see that it really did work really well. So I think that when you find an abstraction or a linguistic structure that’s suitably malleable, that it really can sort of map itself onto any sort of genre that you care about and then that’s the exciting thing. And what becomes even more exciting to me is the fact you have a common language where you can share these musical ideas across these boundaries in ways which are actually pretty hard to do beforehand. And so I’m really excited in the future where the children of Africa are sharing them compositional pieces with the children of America and the children from England and the children from Finland and the children from India just to see what collaborative efforts can be created.
[00:31:30] SY: I’ve seen a couple of your videos on YouTube, of you kind of live DJing at different events. What are some of the favorite things that you’ve done?
[00:31:49] SA: I guess the simplest thing to talk about is the fact that I managed to achieve what I set out to do, which was to be the party at a technical conference. And I’ve become really good at that now. So that’s one of my main skills now is as being a party DJ at a technical conference where I project the code and huge behind me and people are dancing, which is actually quite, I remember when I was at school, we did a lesson, swimming, where we had to swim in our pajamas, and it was really tough because it was really hard to swim with only clothes on. And I remember that’d been with deep memory of mine. Actually, I tried to get programmers to dance. It’s kind of similar. Yeah. When I managed to achieve that, that was a really a beautiful moment for me. Yeah. That was really the goal I set out to do. And that’s the goal I’ve achieved and I was really happy with that. But of course there’s been many other interesting things that I’ve managed to do. I was invited to perform at the Moogfest in the States. That was a beautiful moment for me to actually get people that weren’t going to a technical conference expecting sort of technical nerdery and geekery. These are people going to an actual music festival, expecting music. And so there was a completely different set of expectations. Yeah, that was really beautiful, to get them to dance. It was a lot of fun. That got reviewed in the Rolling Stone Magazine, which is a beautiful thing.
[00:33:08] SY: Oh, cool!
[00:33:09] SA: So yeah. So it was really cool. It was funny because they mentioned me in a sentence alongside Grimes and obviously her creative work. My mind just stayed the same, but I’m super happy with where I am. Yeah, I guess the highlights was there was an organization in London, which works with schools across London to teach music and support their music learning, The Lyric in Hammersmith. And they did a really ambitious project where they got all the scores they were working with, either had orchestras or wind bands or choirs to get them all to work together or where the schools didn’t have those things created new orchestras and created new wind bands and created new choirs and drumming circles. And they got them all together and they hired a composer, Charlotte Harding, and she made a beautiful composition, which combined all of these things. And of course, the reason I was there is that The Lyric in Hammersmith was also doing Sonic Pi lessons for the local children. And so we had a Sonic Pi quartet, virtual live coding with the crazy synthesizers making ludicrous sounds rather than the beautiful dulcet tones of a violin. And this whole thing then was taken to the Royal Albert Hall in London, which is the most spectacular venue. And so we performed at thousands of people. We had to code on a massive projection screen as part of the music, as part of this huge spectacle of children performing. And that was one of the most memorable things I’ve ever done.
[00:34:43] SY: Coming up next, Sam talks about what using Sonic Pi is like and other tools and resources he’d recommend for people to start diving into combining music and code after this.
[MUSIC BREAK]
[00:35:06] SY: So what does it look like to actually use Sonic Pi? If I went on the website, I said, “Okay, I’m ready, Sam’s convinced me, this is going to be fun, I’m going to make some music,” what do I actually do? What are the steps involved?
[00:35:19] SA: I think the first thing to do, which is going to sound really dry and boring, is to lower your expectations.
[00:35:24] SY: Okay.
[00:35:26] SA: So it’s like if you pick up a guitar, you’re not going to be Jimi Hendrix.
[00:35:29] SY: Right.
[00:35:30] SA: And if you pick up a violin, it’s going to sound awful, as you’re trying to learn how to put the bow on the strings and make that sound good. It takes years of practice. So I think it’s really important to lower your expectations and not expect to be able to just be able to make amazing sounds straight away. But once you’ve accepted that is to recognize that you will be able to have creative control over what you do very quickly. It’s just you’ll be much more limited in the scope of what you do and you have to slowly build up your ideas. And the idea is that you open up the Sonic Pi. It’s just a normal editor. It looks like words. It’s a text editor. You write in words. And those words have different colors depending on their meaning, so that you have syntax highlighting. And the simplest code you can write is the word play, and then followed by a number which is the pitch, how high or how low the note is. So you could write play, space, and then the number 17. And then you press the run button on the computer goes, “Ping!” And then you can change the number to be a high number and the computer will make a higher ping and a low number will make a lower ping. So you can explore all the full range of sounds that both the computer can produce and your ears can hear. And those notes are having to map onto the notes of a piano. So the whole number, so 70 to 71, 72 or like the 70th and the 71st and 72nd note to the piano roughly, but you could also use floats. So you can actually say, “play 70.3294,” if you want a note in between it. So you have access to any pitch. So you’re not constrained to Western notation at all. You can really do all sorts of interesting sounds. And then once you’ve done that, then you can write multiple lines where you can say, “Play, play, play, play.” But when you press the run button, the select probably will play all of those notes at the same time. So that’s how you do chords or that’s how you can do drone music where you can have multiple notes, just slightly different from each other, all sort of interacting and beautifully working together. And you can make short notes or longer notes, but adding other options. So all the interesting, simple stuff is really, really easy to write. There’s very little code to write. But as you get more sophisticated ideas, you just need to learn the extra words into actual reality. So by default, a note is one-second-long, sort of beep, right? If you want it to last for eight seconds, you say release eight. The release is sort of a technical term from synthesizer jargon. And so as you’re learning these words, if you’re going to look at the synthesizer, you go, “Oh, I understand all this stuff now.” And so yeah, release is how long the note lasts for. Attack is how long the note fades in for. So you can change sort of the length of the note that way. And then, you can then get done one more command, which is sleep. And that tells the computer to wait before the next note. And so with play and sleep, you have access, which I think is quite profound to be able to compose any piece of music which has ever been created or ever will be created, which is a simple melody. Because if you mentioned a piano is all the notes, that’s obviously constrained to Western music, but it’s which notes to play and when to play it is the composition. Of course, we’re missing out timbre and samples and effects, studio effects and Sonic Pi could do all of those things too. But just to get started, just with play and sleep, which anyone could learn and if you can type and read, then you can do those two commands and you can make your own melodies straight away, and that’s really quite a lot of fun.
[00:38:54] SY: So we talked about what you can do with Sonic Pi. I’m wondering, are there other things, other projects may be that other people are doing combining music and combining that with code?
[00:39:05] SA: Of course. There’s many, many, many, and yeah, Sonic Pi is my thing and the idea of Sonic Pi is to focus on education and lowering the barrier to entry, making things simple. Yeah. I mean, obviously the Overtone project before had a completely different tack, which is try and build a very sophisticated, powerful system, which very few people could use. So that wasn’t very special. But coding and music is obviously out of sight before has been something that’s been explored since computers were created. So you can look back as far back as Max Matthews and the work he was doing then. And for many years, people have been doing interesting experimental work with lisps and programming languages and low-level things, C and Forth and doing all sorts of fun stuff. And so yes, C music was a really interesting project from that kind of world where people were kind of compiling that music, that code. But in terms of the more modern approach, I guess, of doing a performance-oriented stuff, we have these other systems like FoxDot, which is a Python-like environment, that has an interesting pattern language, which is actually based off a system called “Tidal Cycles”, by Alex McLean fabulous system for which has a very thorough syntax. It’s a bit like regular expressions for music. And so with a few interesting characters, you can make really sophisticated patterns to drive both a SuperCollider, which is the same thing that Sonic Pi is on, but also many devices as well and analog synthesizers. Of course, there’s SuperCollider. There’s a language called ixi lang by a really nice person called Thor Magnusson, which has also had a focus on education, and it was in a university context. That was a really a nice system, it’s not a tool something I’ve invented in the slightest. It’s just sort of a wave of excitement have joined into and got involved with.
[00:40:48] SY: So we’ve talked about this idea of generative art on the show in the past. And I know that there was a similar thing that people do with music and code. Can you talk about what that is and how people go about making it?
[00:41:01] SA: I think it’s super interesting. It’s just not for me, mainly because I’m personally interested in finding ways to get the musical ideas from my head as quickly as possible into the speakers. So when I’m performing, I’d like it to be as much as possible my expression is coming out. Whereas I think generative systems are interesting as ways to do automatic composition and especially using sort of AI-style approaches. There’s a ton of interest and work that’s going into these areas. It’s just when I go and see a performance, I want to see a band or an individual performing rather than an algorithm. It must be a sound weird to people listening, thinking, “Well, Sam, you do algorithm and composition. What are you talking about?” And I think this idea of an algorithm is obviously quite weird and sort of, as you try and define it, sort of falls away from you. Although there are algorithms in Sonic Pi, they’re very simple ones. And so they’re really sort of tools of expression. But as of course you can imagine algorithms which are tools which generate tools for expression.
[00:42:04] SY: Right. Right.
[00:42:05] SA: And so yeah. I think that generative sort of music, that’s the kind of thing. And yeah. So I think it’s super interesting and I’ve seen some really cool works where people have used generative systems to create music out of the style of, and they’re obviously trained from a corpus of data, from like jazz or classical or whatever and then they try to recreate works in that style. I think that’s interesting. I think there’s some really interesting work where people have been using generative systems to try and finish off compositions by famous composers who have died midway through composing their piece. And as a way of trying to circumnavigate the problem of, if I was to learn how to do the composition, the style of Bach, then if I finished off a Bach piece, that’s not really Bach doing it. It’s me. But if I train an algorithm to finish off Bach’s work or who is actually composing that, maybe that’s a bit closer to the idea of Bach than an individual doing it. So there are some interesting philosophical discussions that you had around this, and yeah, there’s a ton of really interesting work. It’s just not been my main focus.
[00:43:11] SY: Now at the end of every episode, we ask our guests to fill in the blanks of some very important questions. Sam, are you ready to fill in the blanks?
[00:43:18] SA: No. I can try, I guess so.
[00:43:22] SY: I believe in you. You’re going to do great. Number one, worst advice I’ve ever received is?
[00:43:28] SA: I think the worst advice was do a PhD immediately after your undergraduate degree. That was the worst thing I ever did.
[00:43:33] SY: Oh, tell me about that.
[00:43:35] SA: I mean, obviously it paved the way for all the things we talked about today. And so I’m very grateful, I did that. But I think that to do an endeavor like a PhD, which is essentially an individual project where you have to manage your own time and your own focus and work and you have to come up with a problem and solve it yourself, you need a lot of self-discipline, which I certainly did not have at that time. So it would have been much better to go into industry to get that self-discipline through work and then to go back and do a PhD than doing it straight away.
[00:44:06] SY: Number two, best advice I’ve ever received is?
[00:44:09] SA: Well, I’m going to stick with the same theme. So while I was doing my PhD, I’ve struggled and struggled and struggled and struggled and it took me many more years than it should have done really. And so a lot of that was because of the things I mentioned. I didn’t have that level of self-discipline, which is essential. And I certainly wasn’t a finisher, which you have to be to do a PhD. And that’s definitely a skill I learned. And the advice I got was from my nan. She said to me, “Sam, you need to be like a little red engine.” I said, “What do you, nan?” She said, “You imagine a little train trying to get to the top of the hill, it’s just every day just getting a little bit further and further and further and just going to try and do a little bit, little and often, and eventually you’ll find a way to achieving the big goals that you have.” And that was really a beautiful thing for me, because I really just kept wanting to finish this thing. But actually all I needed to do was write a sentence every day. And then before I knew it, it finished itself.
[00:45:03] SY: Number three, my first coding project was about?
[00:45:06] SA: My first coding project was on the Spectrum making melodies and lines and drew a picture of a house and played a little melody to go with it. And I was really proud.
[00:45:16] SY: Number four, one thing I wish I knew when I first started to code is?
[00:45:21] SA: Oh! Yeah, there’s many, many things I could mention here, but probably the takeaway thing is that I think that what makes a good programmer is not knowledge. It’s not skills. It’s not a pre-inbuilt ability to code and some people have those things and they can certainly help. I think the cool thing that I’ve learned really is that you just need to have patience and perseverance. And just stick at it until it sort of solves it. Even when you’re facing the hardest problems that you just don’t know how to fix, just perseverance and patience has always been my special tool for being able to crack those problems. Nothing else. Just sticking at it and staring at it and thinking about it and not giving in.
[00:46:11] SY: Well, thank you again, Sam, so much for joining us.
[00:46:13] SA: Thank you so much. It’s been a real, real pleasure to be here. Thank you.
[00:46:23] SY: This show is produced and mixed by Levi Sharpe. You can reach out to us on Twitter at CodeNewbies or send me an email, hello@codenewbie.org. Join us for our weekly Twitter chats. We’ve got our Wednesday chats at 9 P.M. Eastern Time and our weekly coding check-in every Sunday at 2 P.M. Eastern Time. For more info on the podcast, check out www.codenewbie.org/podcast. Thanks for listening. See you next week.
Copyright © Dev Community Inc.