Continuing with the theme of music on the microbit, there’s a little bit of complexity in translating from standard sheet music notation - dots and lines arranged on staves - into the microbit’s music DSL - note names, octaves and durations. Longer lasting notes on the microbit have higher note lengths associated with them.
The day before Halloween, it feels appropriate to consider a short piece of spooky music like Mysterioso Pizzicato.
In sheet music, pitches are defined by where they are placed on the stave, the higher the placement, the higher the note. For the micrbot, middle C is represented as C4.
Notes and rests have length values denoted by their individual shape and may be modified by a dot immediately after a note or rest which adds 50% more to the length.
The translation process then goes something like this:
- Set the beats per minute according to the direction in the music.
- Work out how many notes fit into each bar. Notes and rests together should add up to the number of beats in each bar.
- For notes, identify the pitch.
- Identify the duration and append to the note name
Keep testing the transcription as you go along to make sure it sounds correct. It’s easy to miscount or miss a rest, notes that are tied across bars or dotted to extend their duration.
So for the snippet of music above, the score would work like this:
mysterioso = [ 'A4:4', 'C5:4', 'E5:4', 'A5:4', 'F5:8', 'E5:2', 'D5:2', 'C5:2', 'B4:2', 'A4:4', 'C5:4', 'E5:4', 'A5:4', 'F5:8', 'E5:2', 'D5:2', 'C5:2', 'B4:2', 'A4:4' ]
Note how each bar adds up to 16 beats each.