Transcript
All right, let's get really started with
making music. You already know how to play a single note, and now it's time to
create beautiful melodies. Melody is basically a rhythmic sequence of notes.
So how do we do that? You might have guessed it - there can be
more than one play command in a row. Let's type play 60, play 64, and play 67
and press the Run button. Hmm that didn't sound like a melody. Sonic Pi played all
of those notes at once. Fun fact: in music terms that was a C
major chord which makes a happy feeling. When you play multiple notes
simultaneously you're playing actually a chord. We'll cover chords later on now we
just want to play a melody. If you want Sonic Pi the play notes in a sequence,
you have to tell it to take a break every now and then. There is a command
for chilling out between play commands and it's called sleep. Let's try sleeping
in action. Sorry about that. now let's try sleeping
in Sonic Pi by typing sleep 1 under each command like this. Sleep 1 here
and then one more sleep 1 here and finally a sleep 1 here. Now let's click
the Run button and see what happens. Woo-hoo! We finally got a proper melody. So, the
command sleep 1 tells sonic PI to wait for a beat before moving on to the
command on the next line. The number following sleep is an argument. It tells
Sonic Pi how long it should sleep. Now code around with the play and sleep
commands on your own for a while!