rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
MIT License
1.9k stars 159 forks source link

setDetune doesn't work with multiple playing notes #120

Closed migupry closed 4 years ago

migupry commented 4 years ago

I'm executing setDetune() on a Wad that is currently playing.

If only one note is played at a time, setDetune() works just as expected.

If multiple notes are played simultaneously, setDetune() only seems to affect the most recently played noted. Reading through wad's source code, it doesn't seems to be possible to use a mechanism like "labels" on setDetune() as used on the Play() and Stop() functions, and multiple calls to setDetune() also seems to affect only the most recently played note.

Am I missing something here? Is there currently a way to call setDetune() on all currently playing notes? If that's not possible at the moment, could someone please suggest a way to achieve that? The only method I've thought so far is to stop each individual note and play it again using the new detune values. Although it does work, it's not a viable implementation to send multiple Play() Stop() calls to achieve multi-tone detune. Maybe there is a way to implement that digging deeper into the API?

rserota commented 4 years ago

You're not missing anything. In version 4.7.6, setDetune can only be used on the most recently played note from a Wad. If you pull down version 4.8.0, setDetune will accept a label as its third argument, allowing you to individually control multiple simultaneous notes.

I hope you're enjoying using Wad.js.

ghost commented 4 years ago

Hi rserota, I had a chance to test the latest (4.8.0) version of WAD, and setDetune is certainly working as expected. Congratulations on the nice work! I'm implementing a simple synth at the moment, and I'm very happy with the simplicity and versatility of this lib, even though I've barely scratched the surface of it. I could definitely consider this issue as solved. Thanks a lot for your attention.