• UID1571
  • 登录2018-07-20
  • 粉丝5
  • 发帖140
  • 科研点数0点
zt07elecfreaks 发布于2018-01-16 17:52

Micro:bit Fundamental Course:Music

BBC Micro:bit has very powerful music functions. Today we are going to use Micro:bit to make a music broadcaster.

A piece of music usually consists of tones and rhythms. Different tones correspond to different frequencies. And rhythm controls the holding time of a tone. If we change rhythm, the tone will change with it. If we combine tones and rhythms according to a certain rule, then we can create a harmonious melody. If we relate the combination of tones and rhythms to the wavy frequency output by Micro:bit analog footers and its lasting time, and input these signals into a loudspeaker, then it can broadcast the melody. With this conception, we can use Micro:bit to design our own music broadcaster.

Our Goals:

To learn music functions of Micro:bit and create a piece of music with Micro:bit.

Materials we need:

2pcs Crocodile Clip

1pcs Micro:bit

1pcs USB Cable

1pcs LED Music Frequency Spectrum Display Soldering Kit


Use Micro:bit to compose a piece of music and output it with LED Music Frequency Spectrum Display Soldering Kit.



Find a music score. Here we take the song "Are You Sleeping", which you might have known it well and sung it for a lot of times in your childhood, as an example. You can look at the music score below.

Step 2:

After we have found our music, the next step is to open Makecode online editor and start our program.

Usually, the note "duo" in score stands for "1" and its relative music scale is "Middle C". In stave, an independent solid "tadpole" represents a beat. (If you would like to know more music knowledge, you can ask your music teacher for help.) According to this principle, we can translate the first period of music into the following program.

And then we do it the same for the rest music periods to make sure the whole music conversed into code.

Step 3:

Plug input ports as the picture showed below with 2 crocodile clips onto LED Music Frequency Spectrum Display Kit.If you don't have LED Music Frequency Spectrum Display Kit, you can replace it with a music box or earphone. And the cable connection is the same with the picture showed.

Step 4:

Connect Micro:bit to your computer with a USB cable and download the program into Micro:bit. Then let's take a look of the effect!


Louise, one of my colleagues, is a music lover. When she knew we were creating a DIY music case, she made a song "We Wish You Merry Christmas" with Micro:bit for us. You can see her code in the below.

If we want to use Touch Button to shift the above 2 songs freely, then how shall we program? I am looking forward to your comments, feedback, or further discussions with us.

Relative Readings:

Start Your Micro:bit Programming Trip

Micro: bit Fundamental Course–Button&Display

Micro:bit Fundamental Course: Touch Button