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

Getting started with Sonic Pi


Getting Sonic Pi to create a sound is very simple. Type the following code in the Code Editor and click on Run:

play 60

You should hear a tone.

Note

If you do not hear anything, verify that your speakers are switched on and that the sound is not muted.

Here, we represent different notes as numbers; this is a convenient representation that the Raspberry Pi understands. A higher number represents a higher note. Try it for yourself; change the number and click on Run.

If you know a little about music, you might be familiar with the letter names of notes. Sonic Pi knows these too! Try this code:

play :C

This is the same note as before, but now it has a name. Any note from A to G will work, and you can also place a b or s after the name to make the note flat (lower) or sharp (higher).

Finally, we can put a number at the end of the note name to say which octave the note is in. Again, a higher number will give a higher pitched sound. Here's an example note that combines all...

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