Making music with micro:bit - Festive Edition
In this introduction to programming using the micro:bit, students will learn how to create music with their micro:bit.
Suggested time: 50 mins
Learning Objectives:
- Understand and use sequence in an algorithm
- Understand and use iteration in an algorithm (FOR and WHILE loops)
Curriculum Mapping:
KS2:
- Design, write and debug programs that accomplish specific goals; solve problems by breaking them into smaller parts. Select, use and combine a variety of software on a range of digital devices to design and create a range of programs.
- Use sequence, selection and repetition in programs; work with variables and various forms of input and output
- Use logical reasoning to explain how some simple algorithms work; detect and correct errors in algorithms and programs
KS3:
- Use two or more programming languages, at least one of which is textual, to solve a variety of computational problems.
- Make appropriate use of data structures [for example, lists, tables or arrays]; design and develop modular programs that use procedures or functions
What you will need:
- Web enabled device (PC, Tablet, Phone) with an up-to-date browser (Internet Explorer, Safari, Chrome)
- BBC micro:bit simulator (www.microbit.co.uk/)
- BBC micro:bit (Optional)
- Speaker or headphones & two crocodile clips (Optional)
Making music with Make Code:
The built-in music library in Make Code allows us to play music on our micro:bit.
To play a note we use the following command
The built-in music library in Make Code allows us to play music on our micro:bit.
To play a note we use the following command
Where Middle C = note and 1 beat = duration.
Example
Try the following example:
Example
Try the following example:
Did you recognise the tune
Transcribing songs from sheet music
If we want to re-create our favourite songs on our micro:bit, we first need a basic understanding of sheet music.
Here’s a reminder of the most common notes used in a musical score:
The Treble Clef
If we want to re-create our favourite songs on our micro:bit, we first need a basic understanding of sheet music.
Here’s a reminder of the most common notes used in a musical score:
The Treble Clef
Below is the score for a very popular piece of music - Can you can guess what it is?
Answer: Grande Valse (You may know it as the ‘Nokia Ringtone’)
Did you notice the special # symbols at the start of the score. This shows that some of the notes are sharps. In this case, the sharp notes are:
F#, C#, and G#
In Make Code, sharp notes are selected by clicking on the ‘black notes’ in the drop-down keyboard:
Did you notice the special # symbols at the start of the score. This shows that some of the notes are sharps. In this case, the sharp notes are:
F#, C#, and G#
In Make Code, sharp notes are selected by clicking on the ‘black notes’ in the drop-down keyboard:
Below is the music score for the Nokia Ringtone (this time with notes underneath).
It’s all about the timing
If we look at the notes in a music score again, you will notice that they’re different shapes and colours. These different shapes and colours denote the timings. (See below)
Notice that some of the notes have a dot (or full stop) after them. For these notes, we need to multiply the duration by 1.5.
Below is the score again however, this time, with timings (duration).
Rests
Rests are natural pauses or breaks in a piece of music. Rests can be added to your code using the following command:
Rests are identified by the following symbols:
Challenge
- Program your micro:bit to play the Nokia ringtone.
- Use a loop to repeat the ringtone 4 times (or forever if you want to be really annoying!)
- Modify your code so that the ringtone only plays when you press the ‘A’ button
Resources
Sheet music:
Useful links:
Micro:bit Music Fest - All the tools you need to make your own micro:bit band.
MicroPython - MicroPython music reference guide.
Play Tone - Reference guide for making music with Make Code.
Somebody to You: The Vamps - Learn how to play 'Somebody to You' by the Vamps on your BBC micro:bit using MicroPython.
Licence:
Unless otherwise specified, everything in this repository is covered by the following licence:
BBC micro:bit "Magic 8-Ball" lesson is licenced under a Creative Commons Attribution 4.0 International License.