https://arcade.makecode.com/developer/sound#sound-instructions mentions a
music.playInstructions() API, does that currently work?
For background, I wanted to try modifying a white noise effect. The
playMelody API works using
music.playMelody("~5 !200", 60), but it’s not very flexible.
I tried creating a sound instruction buffer, but got stuck trying to play it:
const mySound: Buffer = hex`0500010102027f7f00000101`; music.playInstructions(mySound)
This shows an error in the editor: Property ‘playInstructions’ does not exist on type ‘typeof music’.
I poked around in pxt-common-packages/blob/master/libs/mixer/melody.ts , and it doesn’t look as if
playInstructions(buffer) exists. There’s a
queuePlayInstructions(when, buffer), but that’s apparently not exported?
Am I missing something, or is this currently not implemented?
As a side note, it seems that the noise output ignores the frequency. That seems by design for white noise, but it’s not very flexible. Would you be open to adding a simple square wave + pseudorandom selector combination, similar to what the 8-bit Atari POKEY chip used? See https://www.atariarchives.org/dere/chapt07.php for more discussion of that. Maybe expose this as a new implementation of the removed-but-still-documented metallic waveform? (See pxt-common-packages PR #875.)