It’s been less than a year since I first launched create.withcode.uk to let students and teachers write, run and debug python code without needing to download any software or create any user accounts. Since that time, a new job and new baby have made me fall behind some of the amazing new features added to the micropython runtime for the BBC microbit.
Thankfully, the Christmas holidays have arrived and I’ve now got a little bit of time whilst the boys are asleep – whilst I should be starting on the sack full of marking, reports and lesson prep – to catch up and post some new resources.
I’ve posted before about being able to connect up a speaker to a micro:bit to play sounds. Well, Nicholas Tollervey and the team working on the microbit python runtime have been adding some old speech synthesis code from the 1980s into the micropython runtime that lets your microbit speak. It sounds suspiciously like a dalek from Dr Who, but it’s a really fun feature on such a small device.
I’ve been working on the microbit simulator to let you try out the new speech module in your code. I’ve tested it with firefox and chrome but Internet Explorer doesn’t support web audio so if you’re stuck with using that you can still write and run your code and download it to your microbit but it wont actually speak unless you download the sound file each time your code tries to speak.
Here’s an example program that turns your microbit into a talking dalek that you can tickle by pressing button A:
Have a play and see if you can:
- add your own phrases that you’d like the micro:bit to say when you tickle it.
- use the API documentation to get the micro:bit to sing a song
- find out the maximum length of text that the micro:bit can say. What happens if you try and say more than this?