Musical micro:bit sings Happy Easter

singing micro:bit
python code to make a micro:bit sing

This term in Computing Y8s have been looking at the ways that computers can store, manipulate and display images. Amongst other things, we’ve been using BBC micro:bits to create images, animations and games.

One thing we didn’t get time to look at this term was the data representation of sound.

Maplin (the people who sell all sorts of electronic gadgets and maker kit) have launched a competition where you have to use a BBC micro:bit to create a musical instrument so if anyone’s keen on experimenting over the Easter holidays you can have a lot of fun and possibly win £1,000 worth of gadgets.

This is my entry to the competition, to try to win the maker bundle to share out as prizes at the STEM club I run on Monday lunchtimes at Fulford School, York.

The idea is pretty simple: the latest version of micropython for a micro:bit allows you to write code that will get your micro:bit speaking. You can change the pitch of the speech to make it sound like it’s singing and you can change the speed of the speech to make each word last more or less time.

The code below hooks up the built-in accelerometer to the pitch and speed so that you can tilt your micro:bit to get it singing.

I’ve coded in a series of random Easter messages but you can change the text on line 10 if you want to get it singing your own lyrics.

The singing works in the simulator on as long as you’re using chrome, firefox or edge. Sadly, I haven’t made it work in Internet Explorer yet – you can download the audio it generates but it wont let you play it automatically.

Have fun, and see what you can create! But if you use my code and win the £1,000 prize I’ll expect my share of the goodies!

What can you make your micro:bit sing?

Happy Easter.