You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an AudioWorkletProcessor that defines some parameters. If I change those by assigning directly to .value, everything works as expected. However, if I try to schedule a change by calling linearRampToValueAtTime(), exponentialRampToValueAtTime(), or similar, the value is not changed at all. Reading it back using .value constantly yields the old value, and the processor also only sees the old value. Mainly tested with Firefox 60 (ESR), but from a brief test, Safari and Edge seem to be similarly affected. (The same code in an audioworklet-supporting browser (Chromium) works fine.) Is this an expected limitation of the polyfill? Or am I doing something stupid?
For reference, this a simplified reproducer, where the checkbox should (almost) mute the sine oscillator with fade-in/-out over half a second: test.html:
Hi @martinholters! This is a limitation of the polyfill, and one I'd love to overcome but as of yet haven't found a good solution for. Your timer-based version is novel, but I'm not sure how viable using setTimeout for scheduling would be in a full application. This makes me wonder if it could be modified to use the onaudioprocess event fired by ScriptProcessorNode?
Yes, doing the value update in onaudioprocess sounds like a saner approach. It would even allow the parameter to correctly vary within one block. I'll give it a shot and open a PR if I can cook up something I deem generally useful.
I have an
AudioWorkletProcessor
that defines some parameters. If I change those by assigning directly to.value
, everything works as expected. However, if I try to schedule a change by callinglinearRampToValueAtTime()
,exponentialRampToValueAtTime()
, or similar, the value is not changed at all. Reading it back using.value
constantly yields the old value, and the processor also only sees the old value. Mainly tested with Firefox 60 (ESR), but from a brief test, Safari and Edge seem to be similarly affected. (The same code in an audioworklet-supporting browser (Chromium) works fine.) Is this an expected limitation of the polyfill? Or am I doing something stupid?For reference, this a simplified reproducer, where the checkbox should (almost) mute the sine oscillator with fade-in/-out over half a second:
test.html
:testproc.js
:As a workaround, I have tried this locally:
That does work for my case, but is of course not doing exactly what the standard calls for.
EDIT: Before anyone points me to
GainNode
, in the real use case, I do more elaborate processing, of course, where I cannot use a pre-defined node.The text was updated successfully, but these errors were encountered: