Skip to content

Tones have audible click if stringPlayable value is too long #6603

@y2k04

Description

@y2k04

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions