Book Image

Raspberry Pi Projects for Kids (Second Edition)

By : Daniel Leonard Bates
Book Image

Raspberry Pi Projects for Kids (Second Edition)

By: Daniel Leonard Bates

Overview of this book

Table of Contents (14 chapters)

New sounds


Up until now, we've been using the default sound in Sonic Pi, called beep, but there are many other sounds available.

Open up a couple of empty lines before the loop, type in use_synth, and then press the spacebar. Synth is short for synthesizer, which is a program or machine that generates sound. You will see a long list of sound names appear, with beep at the top. Choose one of the sounds by double-clicking on it or typing enough of its name so that it is the only option. Then press Enter. If you run your code now, you will hear the same notes, but the sounds will be different. Try a few different sounds to see which ones you like.

The use_synth function routine changes the sound of all notes until the next use_synth routine is used. It is possible to change the sound of notes as many times as you like within a song. We can even play a trick similar to the trick that we used when playing a random note. Try adding this line of code inside your loop:

  use_synth choose([:pretty_bell...