WBW :: Playbook :: Play

Welcome to our World Playbook

VIDEO 1 VIDEO 2 VIDEO 3 VIDEO 4 VIDEO 5

VIDEO 4 OF 5
How to play with the song's code

Now that you have your play space ready, it's time to play!

In this video, I suggest 3 simple games to play with the code and start creating your own compositions!

List of games:

⚡️ Game 1: ¿Zero or one?
⚡️ Game 2: Counter, trumpet, and runner!
⚡️ Game 3: ¡Live coding!

GAME 1
¿Zero or one?

For this game, you'll need to open the file 00-live-coding.rb in tab 0.

zerus and ona music

The code in this file is responsible for making each of the instruments within the subfolder /tracks play simultaneously.

zerus and ona folders music

With this game, you'll tell Sonic Pi which instruments you want it to play. For that, you'll make changes to this part of the code:

🥁 = 0
🎸 = 1
🔊 = 1
🔔 = 0
🎹 = 0
🎤 = 1

For example, if you want to play the drum 🥁, you'll assign it a number 1. On the contrary, if you don't want the drum, you'll assign it a number 0.

And so on with each of the instruments on the list.

Go ahead and change a couple of values. Click on File > Run to check that you only listen to the instruments that you chose.

Remember that you can also use Ctrl + R (Windows) or Cmd + R (Mac) on your keyboard.

Every time you want to stop the music, click on File > Stop or use Alt + S (Windows) or Cmd + S (Mac) on your keyboard.

You can play a similar game with the file 01-electronic-beat.rb, in tab 1.

zerus and ona music

The code in this file corresponds to some of the electronic sounds that you hear in the background. Likewise, you can make changes to this part of the code:

🥁 = 1
🔔 = 1

And listen to the instruments that you want. Go ahead and make a couple of changes, click on File > Run and see how the sounds change.

GAME 2
Counter, trumpet and runner!

Now, open the file 03-live-coding.rb in tab 2 of Sonic Pi.

zerus and ona music

The code in this file corresponds to some of the electronic sounds that play in the background.

With this game, you can modify these sounds until you find a combination that you like. To do this, you'll make changes in this part of the code:

🧮 = 10
🎺 = z
🏃 = 7

First, you can tell Sonic Pi how many times you want it to repeat your composition. To do this, you assign the counter 🧮 a number from 1 to 100.

You can also choose the type of trumpet 🎺, assigning it the letter z or the letter o.

Finally, you can adjust the pace, assigning the runner 🏃 a number between 1 and 10.

Go ahead and change a couple of values. Click on File > Run to see the sounds that Sonic Pi makes until you find a composition that you particularly like.

Remember that you can also use Alt + R (Windows) or Cmd + R (Mac) on your keyboard. Every time you want to stop the music, click on File > Stop or use Alt + S (Windows) or Cmd + S (Mac) on your keyboard.

GAME 3
¡Live coding!

In this last game, you'll tell Sonic Pi to play multiple files while you make changes to the code at the same time.

First you have to modify the file 00-live-coding.rb and tell Sonic Pi to only play the piano and the voice. Your code should look like this:

🥁 = 0
🎸 = 0
🔊 = 0
🔔 = 0
🎹 = 1
🎤 = 1

Click on File > Run, or use Alt + R (Windows) or Cmd + R (Mac) on your keyboard, to start playing this file. Please don't stop it.

Once you have this file playing, the fun starts! Let's start making some changes to the code "live" also known as live coding.

To do this, open the file 02-electronic-sounds.rb in tab 2. The game consists of modifying the values ​​in these lines of code over and over again:

🧮 = 10
🎺 = z
🏃 = 7

You can run the code and stop it whenever you want. At the same time, experiment with different sounds repeatedly until you find a composition that you particularly like.

If you've made it this far, CONGRATULATIONS!

You're already part of the 1.8 million musicians using Sonic Pi.

NEXT VIDEO »