Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Raspberry Pi Projects for Kids (Second Edition)

You're reading from   Raspberry Pi Projects for Kids (Second Edition) Leverage the power of programming to use the Raspberry Pi to create awesome games

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781785281525
Length 146 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Daniel Leonard Bates Daniel Leonard Bates
Author Profile Icon Daniel Leonard Bates
Daniel Leonard Bates
Arrow right icon
View More author details
Toc

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...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime