Using Samples

Educator notes

Educator Intro


Length of the chapter: 60 - 120min

Adjust the length of the chapter according to the time you have at hand. There are more detailed lesson plans on the next page.

Learning Objectives

The Student…

  • …will get to know the sample library of Sonic Pi
  • …can code a basic looping 4/4 drum beat
  • …can understand concurrency with live_loops
  • …can use commenting to document the code
  • …can use comments to prevent code from running

Slides and Lesson Plans

You can use the slides below to introduce the second chapter to the students. There are speaker notes in the slides that explain them. To see the speaker notes, click Options > Open Speaker Notes in the bottom panel of the slides or press s. There are similar slides in the Educator Intro of every chapter.

See also the lesson plans below the slides!


Plan 1 - Structured Lessons (90-120 min)

TimeWhat?
10 minScrum-routine: All students (or pairs of students) tell after each other the following things: 1) what they were doing in the end of the previous lesson and 2) if they had any challenges they would need help with. If students are shy to speak when others are listening, you can and talk with them individually later on the lesson.

It doesn't matter if some students are still doing the tasks of the first chapter. You can help those students personally after introducing the second chapter to everyone.
10 minIntroduce the second chapter with the slides above.
10-20 minStudents start the second chapter alone or in pairs and go through the topics Using Samples. Ask the students to raise their hand if they have any challenges.

Walk around the classroom while the students are working and discuss briefly with each student. Talk especially with those who have had challenges or seem to lack motivation. Make sure that every student has some kind of meaningful goal for this lesson.
10 minAsk the students if they have had any challenges so far.

If needed, explain the 4/4 rhythm by showing code from Sonic Pi

10-20 minStudents continue with the topic Programming Those Beats!. Ask students to raise their hand if they have challenges.
15 minReflection discussion: What has been most interesting? Do you have ideas of what to express with the new programming tools?

Introduction to the Exercises
- In the first exercise the students make a single live_loop beat
- The second exercise is the submission. The students will make several live_loops that play together
- Give a time-limit: 10 minutes!
20-30 min

Students work on the exercises

5 min

You can end the lesson (or start the next lesson) by going through a couple of loops the students have made, if they are willing to show them.

Plan 2 - Freely flowing lessons (90-120 min)

Time to completeActivity
10 min

Scrum-routine: All students (or pairs of students) tell after each other the following things: 1) what they were doing in the end of the previous lesson and 2) if they had any challenges they would need help with. If students are shy to speak when others are listening, you can and talk with them individually later on the lesson.

It doesn't matter if some students are still completing the tasks of the first chapter. You can help those students personally after introducing the second chapter to everyone.

5 min

Set a goal for the second (and third) lesson: complete the second chapter. Show the Multiple Loops -exercise of the chapter to the students with a projector and speakers.

Ask the students to start from the topic Using Sampels and then continue forward. Ask the students to raise their hand if they have a any questions.

40-70 min

Walk around in the classroom while the students are working and discuss briefly with each student. Talk especially with those who have had challenges or seem to lack motivation. Make sure that every student has some kind of meaningful goal for this lesson.

If you feel that students have trouble understanding 4/4 beats or live_loops, explain them to everyone together. Check the Educator Notes for more teaching tips related to these topics.

10 min

Reflection discussion: What has been most interesting? Do you have ideas of what to express with the new programming tools?

Introduce the Exercises. If some students have started or completed it already, it doesn't matter.
- Show an example result or show something you have coded yourself.
- Give a time-limit: 10 minutes/exercise!

20 min

Students develop their own loops.

5 min

You can end the lesson (or start the next lesson) by going through a couple of loops the students have made, if they are willing to show them.


Have a Sample

Transcript

Welcome back! I'm sanna from Mehackit and I hope you've had a great start with Sonic Pi. Now you have a good idea about how to play notes and melodies. tThat's all cool but we can do so much more with Sonic Pi! Let's dig deeper by learning how to play samples and how to make some drum beats. The main command for this chapter is called sample. It's used for playing samples from Sonic Pi's sound library. Samples are recorded pieces of sound that can contain for example sounds of drums or animals or sounds of some specific place. To start playing samples open an empty buffer and write the command sample in the code editor. The cool thing is that when you press space after the sample command, you'll see a list that displays all the samples available in Sonic Pi. You don't have to remember the sample names, you just scroll down this list to discover sounds. Sample names always start with a colon and after that comes the sample category and name. Once you've chosen a sample that you want to play you just press Enter or double click. Run the program to play the sound. Nice and simple. Let's do a quick run-through of the sample categories :ambi contains cinematic and ambient samples that are great for painting various soundscapes. And let's try another one maybe the piano one the next category is :bass and this one has some crunchy samples for electronic dance music. Maybe another example let's try that one. All right. I think you should also check out the category :bd which by the way it stands for bass drum. These are some electronic kick drum samples. All right, and another example of these ones. Alright! If you're looking for some acoustic drums you can find those in the :drum category. That's a kick drum and let's look at another common drum called snare over there. Okay and there's so much more that it could take us the whole lesson to go through them. So next I think you should try playing random samples by yourself and discover your favourite ones. There are all kinds of crazy sounds in there like this: All right. By the way did you notice that I didn't press the Run button at all? There's a really handy keyboard shortcut for run and in Windows and Linux its alt + R and for Mac its command+ R remember to try that out too!

Do this
Before going any further, it’s a good idea to spend few a minutes getting to know the sample library. There are many categories of samples all with very different sounds. Check them out!

If you want to get back to the drop-down menu of samples, all you need to do is to press backspace until you hit the sample command. Then press the spacebar again to get back to the list!

sample dropdown visual explanation

What is a sample?
What is the shortcut for running code in Sonic Pi?

Educator notes

Just like note names, sample names always start with a colon. An easy way to see that your syntax is correct is if the text turns pink when it is a sample name.

To get back to the sample drop-down menu, press backspace until you arrive at the word sample. Then press the spacebar again!


4/4 Drum Beat


What is a Bar?

A bar is made up of beats. The number of beats in a bar is determined by the numerator or the top number of the time signature. As you can see in the picture, 4/4 basically means that four beats make up a bar. When counting the number of beats in a bar in Sonic Pi, sleep values are the ones that matter! 

bar visualisation

It doesn't matter whether Sonic Pi plays a note, a sample or does nothing. Time is always counted by sleep values. 

Take a look at how the note and sleep values relate to each other. The note in the middle is a quarter note which is equal to sleep 1. This is the beat, the pulse to which you might nod your head or tap your feet to. Note values smaller than the beat are called divisions of the beat. Every shorter note is half the length of the previous one. Similarly, values larger than the beat are called multiples because they are always twice as big as the previous one.


Do this

Build your own 4/4 drum pattern and use a repeat block to loop it.

The sleep values should add up to 4.

4.times do
    #put your samples and sleep commands here
    #the sleep values inside should add up to 4
end

Educator notes

4/4 is called a time signature in music. The time signature tells us how we count the time in a bar. The first number tells us the number of beats that go into a bar, or in other words, the number we count to. The second number determines the length of the counted beat. In the case of 4/4, one bar has four quarter notes. In Sonic Pi terms this means that one 4/4 bar has four beats of sleep 1, so a total length of sleep 4.

4/4 is the most used time signature in pop and rock music, as well as a defining feature of electronic dance music (EDM.) For this reason, it will probably sound familiar to your students. Other time signatures give a very different feel to the music because of the way we count the bars. In 3/4 we count to three, which is characteristic of waltzes, minuets and some ballads. In 2/4 we count to two, which is typical of marching music and polka.