Skip main navigation

Coding Frère Jacques

In this video you'll learn how to use repetition to create the first half of the song _Frère Jacques_ in Scratch.
2.5
In this video, I’m going to show you how to use repetition to create a song that uses repeated patterns of notes. The song we’ll be making in this video is “Frere Jacques”. And before we start, I’m just going to make the scratch project look a little bit more exciting by adding a backdrop and a different sprite. So for the backdrop, I’m going to choose room one, and for the sprite I’m going to click Music and use the keyboard. And I’m just going to make that a little bit bigger.
40.2
And then let’s delete the cat. There we go. So the scratch blocks we’ll be using to play music are in the extensions in the music section, and we’ll be using this play note block. If you click the Down Arrow to choose the note that you want to play, you’ll see that Scratch gives you the numerical value of the note as well as the letter name of the node. And when I click a note– [NOTE] –you see it plays the note for you so you can tell you’ve got the right one, and then it sets it for you. So when I click the piano sprite, it will play note 60, which is middle C.
82.4
[NOTE] And then for the first part of the song I need four notes. I need C. [NOTE] I need D. Then I need E. [NOTE] And then I need another C. [NOTE] And if I click the [INAUDIBLE]– [NOTES] –you’ll see that it plays each of these four notes, and it’s a little bit fast though. So I’ll change this value to 0.5 of a beat.
138.4
Now the first part of the “Frere Jacques” song has this four notes repeated twice. So I’m going to use a repeat block, and I’m going to change the number of times that these notes are repeated so that it repeats twice. And then I can click the keyboard to test that again. [NOTES]
163.5
So the second part of the song uses the notes E, F, and G. So I’m just going to drag them on now.
173.8
So I have note B– [NOTE] –note [NOTE] –F– [NOTE] –and then note G. And, of course, these three notes also need to be repeated twice. So I’m going to put a repeat block around them.
195.4
Now to test out the second bit of code, what I could do is I could add the second part of the song to the first part, and I could click the piano to play the entire song through. But I already know that this first part is correct because I’ve tested it. So instead, what I’m going to do is I’m going to drag this second part away from the first, and then I can just click on these blocks to test them on their own. [NOTES] And that doesn’t sound quite right to me.
226.1
The third of these three notes should be held on for one beat so that it lasts twice as long as the other two, and the other two should also be 0.5. Let’s test it. [NOTES] Great. Now I know that this second bit of code works. I can then drag it and attach it to the first part. So now we’re creating the entire song.
261.5
You’ll notice though that playing the entire song takes quite a long time, and it would take even longer the more of the song that we put together. So another block that’s useful to show you is the set tempo. So the tempo at the moment is 60 beats a minute. And actually we can click the tick box next to the tempo so that we can see it on the stage.
287.2
And we can see that the tempo has been set to 60 beats a minute. So it will play each of these notes at half a beat with 60 beats in a whole minute. So if we want to test the entire song, we could actually change the tempo of the song to a hundred beats a minute so that it’s a bit quicker to test it.
311
And now I know that’s right. I’m just going to put the tempo back to 60. And I don’t need to see this variable anymore either, so I’m going to untick that box.
324.9
And now you’ve seen the first two parts of the song. Your challenge is to code the rest.

In this video you’ll learn how to use repetition to create the first half of the song Frère Jacques in Scratch.

You’ll then be able to use what you’ve learnt to make the rest of the song.

This article is from the free online

Teaching Programming in Primary Schools

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education