There are lots of options to play rtttl tunes (aka nokia ring tones) on Arduinos and directly in micropython parsing it directly, but the micro:bit has its own format for playing tunes and parsing an rtttl string does not seem efficient. Besides, the play function in micropython allows for asynchronous playing. So, I have uploaded to
my repository and Excel file with macros (I am sorry for those without Excel, but schools typically have Excel installed on their machines), which allows converting rtttl sequences to micropython code:
This
Code: Select all
WeWishYo:d=4,o=6,b=35:16a5,16d6,32d6,32e6,32d6,32c#6,16b5,16g5,16b5,16e6,32e6,32f#6,32e6,32d6,16c#6,16a5,16c#6,16f#6,32f#6,32g6,32f#6,32e6,16d6,16b5,16a5,16b5,16e6,16c#6,8d6
Would be converted to this
Code: Select all
import music
# WeWishYo
music.set_tempo(ticks=16, bpm=35)
tune = ['A5', 'D6', 'D:2', 'E', 'D', 'C#', 'B5:4', 'G', 'B', 'E6', 'E:2', 'F#',
'E', 'D', 'C#:4', 'A5', 'C#6', 'F#', 'F#:2', 'G', 'F#', 'E', 'D:4',
'B5', 'A', 'B', 'E6', 'C#', 'D:8']
music.play(tune)
There are lots of resources on the internet for rtttl tunes, but my recommended first stop would be the
Picaxe website. You can also use different tools to
convert midi files to rtttl.