Making Micro:bit Music
It’s been a couple of weeks and I confess I’m rusty. Riding high on a sea of ‘I feel confident about micro:bits now’ I was brought back down to earth when my colleague said ‘come on just program button A, you wrote about it in your blog post. How can you have forgotten?!’
So today I’m going to make music with my micro:bit and our sound cable which gives you the option to plug in headphones or speakers. Starting with something simple, I’m often singing ‘twinkle twinkle’ to my 18 month old, so yeah let’s let family life spill into work for a change 😉
The first thing to do is write the code. I open up a new Project and give it a name.
I then select the Music category from the menu and have a look at the choices. There is actually the facility to make something quite sophisticated which explains why one of my colleagues who is also a music graduate had so much fun coding Wagners ’Ride of the Valkyries’ last summer!
I think for this rather more basic project I’ll only need ‘playtone’ ‘rest’ and ‘set tempo’ blocks.
Then select ‘music’ category from the menu and ‘set tempo’ it automatically comes up as 120 bpm. No idea whether that will be ok, so I’ll leave it like that for now and see.
Next step is to drag and drop the play tone blocks. It automatically comes up as middle C but if you click onto it you get a keyboard visualisation which is rather nice (I have little bit of a music background). I need middle C anyway so that’s handy (I googled the notes I needed for the tune).
Pretty straight forward after that. Drag and drop tones and then change the length of the beat appropriate to what you are trying to play. I started with half beats for twinkle twinkle.
So after making four notes I feel it’s time for a little preview on the simulator. Press button A. OK…the notes are entirely indistinguishable. I think I need to slow the tempo down!! I change it to 60 but it could still do with being slower so I go for 40.
Once I have programmed the whole tune and checked the preview I’m good to download. Even though I shouldn’t be surprised that it works, can’t help but feel thrilled and creative to hear my little tune playing away on my micro:bit!