AudioParam.setTargetAtTime() always results in 0 for timeConstant=0 |
||||
Issue descriptionI confirmed this problem on GainNode, and didn't check on other nodes. But it does not work correctly when setTargetAtTime() is called with timeConstant=0. Confirmed at Chrome version: 51.0.2704.103 (Official Build) Example code snippet. const context = new AudioContext; const osc = context.createOscillator(); osc.start(); const gain = context.createGain(); osc.connect(gain).connect(context.destination); const target = 1.0; const timeConstant = 0.0; gain.gain.setTargetAtTime(target, context.currentTime, timeConstant); This results in generating click noise and silence. Note: 1. Click noise is always generated at the start time of setTargetAtTime regardless of target and timeConstant values. 2. If timeConstant is 0, gain results in 0 regardless of the target value. Demo: https://jsfiddle.net/toyoshim/0ynt4bz7/
,
Jul 25 2016
Yeah, it's supposed to throw an error if the time constant is zero. Chrome 52 does, in fact, throw an error. But see https://github.com/WebAudio/web-audio-api/issues/850. No resolution on that issue yet. This would be an incompatible but minor change.
,
Jul 26 2016
Oh, thanks. Let me join the discussion there :)
,
Sep 26 2016
Time constant of 0 is allowed: https://github.com/WebAudio/web-audio-api/issues/850#issuecomment-248882050
,
Oct 20 2016
,
Dec 9 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9f2135a54d2c7d6112f426a4a988e16a1c4ca9f2 commit 9f2135a54d2c7d6112f426a4a988e16a1c4ca9f2 Author: rtoy <rtoy@chromium.org> Date: Fri Dec 09 20:00:35 2016 Allow timeConstant=0 for setTargetAtTime setTargetAtTime should allow a time constant of 0. This means the output value jumps instantaneously to the target value at the start time. Spec: https://webaudio.github.io/web-audio-api/#widl-AudioParam-setTargetAtTime-AudioParam-float-target-double-startTime-float-timeConstant BUG= 630869 TEST=audioparam-setTarget-timeConstant-0.html, audiparam-exceptional-values.html Remove test for timeConstant=0. Review-Url: https://codereview.chromium.org/2426893003 Cr-Commit-Position: refs/heads/master@{#437614} [modify] https://crrev.com/9f2135a54d2c7d6112f426a4a988e16a1c4ca9f2/third_party/WebKit/LayoutTests/webaudio/audioparam-exceptional-values-expected.txt [modify] https://crrev.com/9f2135a54d2c7d6112f426a4a988e16a1c4ca9f2/third_party/WebKit/LayoutTests/webaudio/audioparam-exceptional-values.html [add] https://crrev.com/9f2135a54d2c7d6112f426a4a988e16a1c4ca9f2/third_party/WebKit/LayoutTests/webaudio/audioparam-setTarget-timeConstant-0.html [modify] https://crrev.com/9f2135a54d2c7d6112f426a4a988e16a1c4ca9f2/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
,
Dec 13 2016
Woohoo! Thank you for working on this :)
,
Dec 13 2016
Sorry for taking so long. Hope this helps you out! |
||||
►
Sign in to add a comment |
||||
Comment 1 by toyoshim@chromium.org
, Jul 24 2016