Talks

Summarized using AI

Anatomy of a Sonic Pi Song

Raia • November 24, 2023 • Bern, Switzerland

Introduction

The video titled "Anatomy of a Sonic Pi Song" features Raia, who presents insights on what makes a good song and showcases how to synthesize music using Sonic Pi, a Ruby-based programming environment designed for live coding music.

Key Points

  • Understanding Music Composition: Raia begins by discussing the elements that contribute to a good song, such as melody and rhythm, which he relates to different use cases, including workout music.
  • Introduction to Sonic Pi: The session quickly dives into the Sonic Pi interface, where Raia explains key commands like play and sleep, essential for composing music through coding.
  • Creating Sounds: He demonstrates how to create melodies by playing with notes and synchronizing different sounds. Participants learn about the built-in synthesizers and how to manipulate them for varied audio effects.
  • Using Samples: Raia introduces the concept of samples—audio snippets that can be altered to create diverse sounds. He fills in some sample sounds to add depth to the music, namely bass and percussion elements.
  • Live Coding Techniques: Raia emphasizes the importance of live coding by making real-time changes to the music. He illustrates this by creating a simple 4/4 rhythmic structure and looping it to enhance the overall sound.
  • Practical Application: As part of the demonstration, Raia builds an EDM drop with minimal lines of code, showcasing the ease of generating music creatively using Sonic Pi.
  • Original Composition: He shares his original song, "Play the Long Game," illustrating how Sonic Pi aids whole music creation from conceptualization to execution. Raia underscores the importance of structure and personal touches in coding music, even reflecting on coding efficiency from initial drafts to current works.
  • Personal Journey and Influence: Raia concludes by sharing his personal journey with Sonic Pi, having started as a project manager in an informatics unit. He highlights the creative possibilities Sonic Pi opened up for him, extending to visualizing ecosystems with sound.

Conclusion

Raia’s presentation serves as an excellent introduction to live coding in music creation through Sonic Pi. He emphasizes creativity in coding, showcasing how programming can be an artistic tool as much as a technical one, and ultimately inspires the audience to explore sound synthesis further.

With engaging examples and insightful perspectives, viewers gain a deeper understanding of both the technical and creative aspects of making music with Sonic Pi.

Anatomy of a Sonic Pi Song
Raia • November 24, 2023 • Bern, Switzerland

Have you ever considered what makes a "good" song? Maybe it's a sweet melody, or the beat that keeps you pushing through to the end of a workout. Whatever the use case, Ruby-based Sonic Pi can synthesize it. Raia guides participants through coding a range of song components. Together, we'll build a band of live loops including: rhythm sections, melody, chord progressions and audio embellishments. We'll build a song that can be mixed and modified at will and in the process, learn some key elements of what makes Sonic Pi "sing.”

Helvetic Ruby 2023

00:00:09.920 Hello, everyone! I’m Raia, and that was quite the intro. Thank you!
00:00:15.360 I'll jump right in. Have you ever wondered what makes a good song? Maybe it's a sweet melody or that beat that keeps you pushing through to the end of a workout.
00:00:22.960 Whatever your use case, Ruby-based Sonic Pi can synthesize it. Today, I'll guide you through coding a range of song components, and together we'll build a band of live loops including rhythm sections, embellishments, chords, and melody.
00:00:33.239 From there, we'll construct a song that can be mixed at will, and in the process, learn some key elements of what makes Sonic Pi 'sing.'
00:00:39.680 So, let's go! This is the Sonic Pi interface. You have some comments there with my information if you're inclined. Above that are our commands, which can be triggered with the keyboard when you're live coding.
00:01:03.120 As developers, you know how to use keyboard shortcuts! Let’s get into the commands. It's really simple: play and sleep. When we play a note, we can relate it to a note like C, if that means anything to you.
00:01:30.360 Let's listen to what we have. We just got a nice beep; that's our default synth. We can add more sounds. If we want to play something different, we can just change the number.
00:02:00.240 Kind of clear? I want to play two notes. Let's see if this will work. We've got it in Symphony, so I'm going to teach it to play in order.
00:02:04.320 You got it, right? We can play around with those numbers, remove the line that includes sleep to play in concert and see what happens. When we're staying play, we're actually calling upon built-in synthesizers to play within Sonic Pi.
00:02:31.840 Now we've just heard a beep; it's kind of boring. It's just your regular sine wave, but there are other synths built into Sonic Pi itself. I'm going to call upon my Usynth, and we get some nice drop-downs to help us out.
00:03:08.400 Let's hear that. Oh, that's a little interesting—a little funkier! From here, we can not only use synthesizers but also add samples. Samples are just audio snippets that you can manipulate to sound faster, slower, or completely different from the original tone.
00:03:20.560 Let's fill in some samples here. I'm going to let Sonic Pi lead me, and as you can see, it's prompting us with some options. I feel like I want some bass. I don’t know about you guys. Maybe we'll get into some bass drums because that will come into play a little later.
00:03:45.080 And why not add one more sample for fun? This is normally done in my basement cave, so thank you for being here! Let's hear what we have and figure out if there are some typos, which will be some fun too.
00:04:15.080 Okay, that was a little different, right? I'm with you. What happened? One of the samples is much longer than anything else we have, or our sleep in total. I'm going to just put it out there, and I'm guessing it's the first one because something started and never stopped.
00:04:49.600 BD in line 10 corresponds to the bass drum—just a random little snippet. And of course, the cowbell is also a one-off sound. I'm kind of grooving with it, though. Let's listen to it one more time.
00:05:23.920 I like it! I'm not upset. I mean, I could be; I could do something, I don't know—but honestly, this is kind of boring. It's pretty step-by-step.
00:05:49.520 The way I actually live code is I change things on the fly. So let’s do that! I'm going to add in a loop, and let's see it play continuously.
00:06:08.760 Now things are getting somewhere. What is this? A little funky, a little fun—but now we can consider the timing. A lot of popular music uses something called 4/4 time, so we want our sleep to total a factor of four.
00:06:29.440 That could be 2, 1, 0.5, 8, 16, and so on. Right now, I'm saying that sleep is a total of three, so let's just keep it simple and copy that in.
00:06:53.080 Okay, now let's see if this is something I feel like I could run to.
00:07:07.750 So, this can be our first instrument, and I’m actually going to make this a little smaller. If you can’t see, just raise your hand, and I'll make it bigger again.
00:07:30.360 I want to add another instrument. This block of code kind of represents our melody. It's a little abstract today, but let's see what happens.
00:08:01.280 First, I want to isolate the drum section we just added, but I got a runtime error. Sonic Pi will give you feedback if you're doing something it doesn't like.
00:08:36.760 Here, it’s telling me the loop did not sync. It's helpful because it even tells you which loop is problematic. We're going to add a little adjustment and comment this out so we can fully hear our drums.
00:09:02.880 It’s a very simple drum. I might want to change it on the fly.
00:09:38.000 So, we've created an EDM drop with just four lines of code! I love noodling around with Sonic Pi—it creatively satisfies me.
00:10:01.680 This is where you could start, but I’d also love to share a bit about where I come from with it and what I do.
00:10:22.080 I'll start with an original song. This is the strangest venue ever for that, but I want to showcase Sonic Pi in action.
00:10:38.720 It's structured differently than a performance; I might mingle some comments with it, but I hope you enjoy.
00:11:05.600 This is called 'Play the Long Game' and is an original song of mine.
00:11:43.840 So, you’ve been told your worries of yesteryear are all gone away. The thing about playing the long game is that it's your only way.
00:12:35.600 This is like the least efficient code possible; it's fun! I think there are places where I’m like, 'Oh, you added this at month three,' and then 'that at month five.'
00:13:02.520 Today, I could make sense of it in ten lines of code, whereas I have fifty— and that’s me.
00:13:22.560 I've labeled things in a way that I know what they mean; long bass is this booming synth that hugs your heart a little.
00:13:49.280 During a chorus, I can bring my dubla in, and let’s give it a bit more.
00:14:06.640 I've made some decisions while allowing Sonic Pi to pick between a couple of variables.
00:14:31.760 I also add notes to myself, indicating where I can make adjustments.
00:14:52.920 Now, maybe I want to change the song. How do I go about that? I’ve just changed the variables, and this is a Danish artist, Weina Aab.
00:15:09.680 I found this on TikTok about a year ago, and I thought, 'This is such a good song, I need to sing it!'
00:15:59.020 You can hear some changes, and for those who know the song, I pulled up some lyrics. I enjoy singing along.
00:16:32.680 Every second, every day, I spend thinking this is where I belong. I have no doubt in my mind we would make it far.
00:17:06.560 I want to remember this moment in time with you, and I hope you’ve enjoyed a glimpse into my practice.
00:17:29.240 Thank you for your patience and acceptance.
00:18:31.880 I think today has been a bit of déjà vu, as the first place I really dug into Sonic Pi was at a research institute I used to work at before moving to India.
00:19:00.920 I was in the informatics unit as a project manager, and although I wanted to code, it felt outside of my realm.
00:19:39.360 But then, I discovered Sonic Pi, and it sparked a journey that I would like to share with you.
00:20:10.360 I feel like Sonic Pi has allowed me to expand into ideas like visualizing ecosystems with sound and implementing this creatively.
00:20:49.280 Thank you so much for listening!
Explore all talks recorded at Helvetic Ruby 2023
+5