Sound effects extension update

I’ve updated my unofficial sound effects extension to add support for looping sounds in v1.1.0. This is intended for continuous background noises.

You can modify sound parameters while it’s looping, for example changing frequency to adjust an engine noise based on the current speed. Here’s an example:

If you want to use it in your own project, click on Advanced / Extensions in the editor’s blocks menu, and copy the extension’s address into the search field:

https://github.com/klausw3/pxt-sound-effects

(I’ve started a new thread since the initial announcement had been a bit buried in a long discussion. All the waveforms are now available in the stable version of Arcade, so please ignore any references to “beta editor only” from old threads such as that one.)

To explore the available waveforms, try this example which displays the current waveform and pitch:

On a technical note, it’s unfortunately not easy to get a smooth continuous sound loop using the current sound scheduling API. I copied some logic from playTone in melody.ts, but there are still gaps and audible transitions. I think it would be useful if the low-level API provided a way to let a sound instruction replace a previous one directly, i.e. based on an app-assigned voice ID, so that a sound can effectively be updated in-place without needing careful timing.

2 Likes