Ruby
Live Coding Music with Sonic Pi
Summarized using AI

Live Coding Music with Sonic Pi

by Sam Aaron

The video titled "Live Coding Music with Sonic Pi" by Sam Aaron, presented at RubyConf 2017, explores the innovative intersection of programming and music through the use of Sonic Pi—a Ruby DSL and IDE designed for live coding music, particularly in educational settings. In this engaging talk, Aaron emphasizes the following key points:

  • Introduction to Sonic Pi: Aaron introduces Sonic Pi not merely as a tool for creating music but as a means to help people engage and connect through programming. This unique platform allows users to compose music interactively and creatively using code.

  • The Importance of Engagement: The presenter highlights a common frustration programmers experience when discussing their profession with others. Instead of defining himself as a programmer, he opts to identify as a musician to foster better conversations and connections, showcasing the broader implications of coding beyond traditional job aspirations.

  • Creativity Through Coding: Aaron argues that programming can be an amazing form of self-expression and that Sonic Pi demonstrates how coding can engage students by making it approachable and fun. He conveys that coding offers opportunities for creativity akin to how writing or sports can provide outlets for expression.

  • Technical Features of Sonic Pi: The description includes several technical innovations unique to Sonic Pi, such as rhythmically syncing multiple threads, implementing lexical blocks to manage time, and manipulating state, all while maintaining immediate feedback—the core of live coding.

  • Interactive Learning: Aaron describes the Sonic Pi interface, emphasizing its user-friendliness, real-time feedback, and instant results which make it an effective educational tool. He reflects on the challenges teachers face in engaging students and posits that Sonic Pi can bridge the gap in attention and interest.

  • Exploration of Sound: The ability to manipulate sounds, apply effects, and incorporate musical samples in Sonic Pi allows for rich exploration of music creation. The presenter encourages experimentation with layering sounds, generating rhythms, and pushing the boundaries of traditional coding.

  • Conclusion: Aaron concludes with a call to integrate more artistic elements into programming education and encourages the audience to see programming as a pathway to creativity. He advocates for using programming skills to engage broader audiences and transform the perception of coding into a meaningful art form.

Through this demonstration, Aaron aims to inspire individuals to embrace programming as a multifaceted skill, highlighting its potential for artistic expression and engagement in a way that resonates with a wide audience, not just those in tech-related fields.

00:00:18.330 Right, so because how do you go to parties? I’d be there, whistling. I mean, I’ve got three kids, so I’ve been out of the party scene for a while. But when I did go to parties, you meet people who go, "What’s your name?" and have a conversation. This is quite unusual for me, considering I program all day.
00:00:31.410 They ask me, "What do you do?" and I say, "I’m a programmer." Then they just walk away. Let’s do a programming party, then, that’s fine.
00:00:37.860 But at normal parties, I don’t know about you, but I find that deeply frustrating because there’s so much beauty and joy in programming to share with everybody.
00:00:44.789 The inability to even start talking about it to people who don’t have a direct interest is really frustrating. I find it a restriction. So now, if I go to a party and they ask me what I do, I say, "I’m a musician." "Oh great! What do you play?" Now I’ve at least got some common ground.
00:01:11.430 What I’m trying to do is provide you with a tool that you can use to help have that conversation. But actually, the real problem isn’t just your party experience; I think the real problem lies in how we engage everybody else, not just the people who are older and ideally like-minded.
00:01:32.040 When people say, "Why do you need programming?" they often think it’s just to get a job. I don’t know—most of you probably all have jobs because you can program, but you all probably, like me, see programming as quite weird.
00:01:50.220 You probably discovered programming for its beauty, its joy, and you spend time learning about it on your own. So, you’re all quite unique in that sense.
00:02:10.110 I think the reasons that got us started in programming aren’t necessarily the same reasons that others might have to start. We need to look beyond our own culture and our own programming communities to think about how we engage with other people.
00:02:29.340 When we talk about engagement, it’s similar to how people learn sports in school to become professional athletes; some people do, but not everyone. Should we only teach sports to those who are already interested? There are so many beautiful, positive things that come from studying sports beyond just getting a job. The same is true for programming!
00:02:56.430 Think about it: How many people believe that reading and writing are only for business? Reading and writing have so many other uses; I mean, how many of us see this fear that writing just makes rich people richer? Yes, of course! But I always say to programmers, you've got unbelievably great skills; what are you using it all for? Often, many programmers use it purely for commercial gain. I think there are more things we can do.
00:03:38.340 I think that engaging broader audiences, especially young people, shows them that coding is more than just writing business applications or websites.
00:03:57.840 I mean, if you do agree, then maybe we need to start a conversation about what the opportunities are. Ideally, we should consider why we program if it’s not just for jobs. I think coding is an amazing tool that can be used for self-expression, much like technology.
00:04:17.600 Computing is also a powerful means of expression. It's so amazing how young you can introduce this idea.
00:04:34.370 So, if you watch a programmer, they open it up and talk about how programming has become more accessible. They explore various fields of study, and it creates a gap. They reflect on past worries like where the Nile floods and consequently created compasses and maps.
00:05:06.620 Why does programming remain so relevant? We haven’t figured out everything we can do with it yet! I believe there’s a lot of exciting opportunities in small projects, and music is one of the many things you can explore with computing.
00:06:03.800 Let’s go back to what I was saying earlier; it’s about engagement because people already program. The best part is when it gets really exciting. This is what I created, Sonic Pi: a Ruby DSL that, like Rails, doesn’t make websites but instead generates sound.
00:06:20.480 In the same way Rails aimed to simplify complex enterprise applications, Sonic Pi has similar properties. I developed it in hopes of seeing it used in schools.
00:06:47.080 However, the experience differs: teachers struggle to engage kids, spending loads of time trying to get their attention. They often rely on various techniques to keep kids' attention; counting down, clapping, or calling their names. But most likely, they only have a brief two or three sentences to engage students before they wander.
00:07:13.740 So ideally, the objective is to compact that communication, to get to the essence quickly.
00:07:35.270 This is why Sonic Pi functions as your text editor as well. I built my own so that you just download it—Mac or PC—and open the application. You get this environment where you can type text, run it, and see immediate results.
00:08:15.540 For example, in defining local variable methods, you can provide an auto-completion! You can give a number or set a duration and get your music going based on whatever parameters you define.
00:08:53.580 Kids can explore this functionality, experiment with notes, and see something happen live. This makes coding incredibly engaging! Just one line of code can get them really interested as they start to create sounds.
00:09:41.890 Sonic Pi has a way of visualizing what happens in your code, allowing you to understand object-oriented programming in a creative way. So, you write a note and consider various musical parameters without worrying about traditional programming constraints. This is where the creativity blends with technical learning.
00:10:36.920 Which is fantastic, actually! You can create an entire melody interactively in real-time. It offers a different angle than traditional programming; it’s ultimately about how to engage creatively while exploring and expressing yourselves through sound.
00:11:38.980 If I want to take things to the next level, we can also modify sounds using built-in synthesizers. So, you can change effects, create variations, and get hands-on while exploring this interactive playground. There’s a huge catalog of sounds and instruments to dive into.
00:12:57.990 We can even use samples - you have the option to employ famous drum breaks or musical elements that might have been signature in other artists' works, making it feel like a real production environment.
00:13:45.190 We could start building something that brings all these elements together. It’s about integration and experimentation; how can you develop layers? Change parameters to explore sonic textures.
00:14:34.020 As we advance into composition, you see how sound programming helps with understanding structure and timing, linking back to coding’s logical sequences.
00:15:49.130 By conveying this information through music, you build elegance in your compositions, making it a refreshing practice.
00:16:05.850 I want to show you how simple it is to combine and sequence different elements effectively. You’re not just coding; you’re creating art! I’m so excited to share these tools.
00:17:28.450 Now, let’s use another function that will enable us to manipulate parameters effectively. Yes, let's play with filters and synthesizers—exploration is endless.
00:18:04.360 Just because one option exists doesn’t mean it’s the only way; have fun experimenting with layering sounds, rhythm, and programming.
00:18:55.560 Simultaneously, you might encounter challenges, but embracing your creativity can lead to fascinating discoveries in what music can become.
00:19:50.620 The key is to dive in; think about how your coding can relate to something like a symphony—lots of moving parts that come together to form harmony!
00:20:59.930 We can continue to develop, adapt, and explore those systems that shape music using modern programming languages, enabling everyone to participate in an artistic venture.
00:22:05.040 Thanks for following along today; I hope you took away some innovative ideas. Let’s keep the conversation going about engaging more people through this beautiful art form!
00:23:17.480 And remember: you don’t need to limit your exploration to coding for business; programming can be an outlet for creativity and innovation.
Explore all talks recorded at RubyConf 2017
+79