- 
                Notifications
    
You must be signed in to change notification settings  - Fork 699
 
Description
Describe the bug
The audio in the simulator starts becoming more and more crunched and clicky if the value inside music.stringPlayable is too long (well over 8 notes).
To Reproduce
See project: https://makecode.microbit.org/S15391-85779-51473-58196
Expected behavior
Clear sound.
micro:bit version: Not hardware related.
Desktop:
- OS: Windows 11
 - Browser: Firefox
 - Version: 143.0.1
 
Additional context
I did find a workaround for the moment. I split up the notes into groups of multiple lines, with 8 notes per line. It still begins to lag if I play it in whole groups. So to fix that, I split it further at runtime by spaces.
parts[part].split('\n').forEach(bars => bars.split(' ').forEach(
        note => music.play(music.stringPlayable(note, bpm),
            music.PlaybackMode.UntilDone)
    )
The weird tempo math in the example is due to the tool I used to convert a MIDI to notes and is unrelated to this issue. I fixed that issue by writing the notes by hand in another project.
Here is that project that doesn't crackle and runs in time: https://makecode.microbit.org/S52364-91538-71429-16712