New issue
Advanced search Search tips

Issue 807301 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

WaveShaper incorrectly outputs 0

Project Member Reported by rtoy@chromium.org, Jan 30 2018

Issue description

See https://github.com/WebAudio/web-audio-api/issues/1478

Here's a quick example illustrating the issue (use canopy to see the output):

let src = new ConstantSourceNode(context, {offset: .5});
let shaper = new WaveShaperNode(context, {curve: [1, 1, 1]});

src.connect(shaper).connect(context.destination);

src.start();


This produces a constant 1 output. But change the offset value for the constant source to 0, and the output becomes 0.  This is incorrect.

I'm guessing an optimization assuming zero input produces zero output for the waveshaper is being done.  This is incorrect if the curve doesn't map 0 input to 0 output.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jun 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/325b492fe733ba4c8b2128069a0a232fea1789e3

commit 325b492fe733ba4c8b2128069a0a232fea1789e3
Author: Raymond Toy <rtoy@chromium.org>
Date: Mon Jun 04 19:29:17 2018

WaveShaper must output non-zero values even if input is silent

If the curve for the WaveShaperNode is such that a zero input produces
a non-zero output, the WaveShaperNode needs to output that value even
if the input is silent (or disconnected).

Do this by setting the tail time of the processor to 0 or infinity
depending on whether the curve specifies an output value of zero or
not, respectively.

Bug: 807301
Test: WaveShaper/silent-inputs.html
Change-Id: I6539d2e00f5d3e624ffaf2810944eb6d53d6f84b
Reviewed-on: https://chromium-review.googlesource.com/896266
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564186}
[add] https://crrev.com/325b492fe733ba4c8b2128069a0a232fea1789e3/third_party/WebKit/LayoutTests/external/wpt/webaudio/the-audio-api/the-waveshapernode-interface/silent-inputs.html
[modify] https://crrev.com/325b492fe733ba4c8b2128069a0a232fea1789e3/third_party/blink/renderer/modules/webaudio/wave_shaper_dsp_kernel.cc
[modify] https://crrev.com/325b492fe733ba4c8b2128069a0a232fea1789e3/third_party/blink/renderer/modules/webaudio/wave_shaper_dsp_kernel.h
[modify] https://crrev.com/325b492fe733ba4c8b2128069a0a232fea1789e3/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.cc

Project Member

Comment 2 by bugdroid1@chromium.org, Jun 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/db982853616d0152e7d3490ce81171f547839965

commit db982853616d0152e7d3490ce81171f547839965
Author: Matt Giuca <mgiuca@chromium.org>
Date: Tue Jun 05 03:48:19 2018

Revert "WaveShaper must output non-zero values even if input is silent"

This reverts commit 325b492fe733ba4c8b2128069a0a232fea1789e3.

Reason for revert: Broke webaudio/.../waveshaper-364379.html in
webkit_layout_tests. See  https://crbug.com/849535 

Original change's description:
> WaveShaper must output non-zero values even if input is silent
> 
> If the curve for the WaveShaperNode is such that a zero input produces
> a non-zero output, the WaveShaperNode needs to output that value even
> if the input is silent (or disconnected).
> 
> Do this by setting the tail time of the processor to 0 or infinity
> depending on whether the curve specifies an output value of zero or
> not, respectively.
> 
> Bug: 807301
> Test: WaveShaper/silent-inputs.html
> Change-Id: I6539d2e00f5d3e624ffaf2810944eb6d53d6f84b
> Reviewed-on: https://chromium-review.googlesource.com/896266
> Commit-Queue: Raymond Toy <rtoy@chromium.org>
> Reviewed-by: Hongchan Choi <hongchan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#564186}

TBR=rtoy@chromium.org,hongchan@chromium.org

Change-Id: I29fd96b1a9dd2b87db12867031399b069beba706
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 807301,  849535 
Reviewed-on: https://chromium-review.googlesource.com/1086647
Reviewed-by: Matt Giuca <mgiuca@chromium.org>
Commit-Queue: Matt Giuca <mgiuca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564359}
[delete] https://crrev.com/8afa16fbeed700655df3e2dcd5f83175b0a415f3/third_party/WebKit/LayoutTests/external/wpt/webaudio/the-audio-api/the-waveshapernode-interface/silent-inputs.html
[modify] https://crrev.com/db982853616d0152e7d3490ce81171f547839965/third_party/blink/renderer/modules/webaudio/wave_shaper_dsp_kernel.cc
[modify] https://crrev.com/db982853616d0152e7d3490ce81171f547839965/third_party/blink/renderer/modules/webaudio/wave_shaper_dsp_kernel.h
[modify] https://crrev.com/db982853616d0152e7d3490ce81171f547839965/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.cc

Project Member

Comment 3 by bugdroid1@chromium.org, Jun 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/be0ac4b3ec4972e8c6297fc0700f625da46c5bf0

commit be0ac4b3ec4972e8c6297fc0700f625da46c5bf0
Author: Raymond Toy <rtoy@chromium.org>
Date: Tue Jun 05 20:07:23 2018

Reland "WaveShaper must output non-zero values even if input is silent"

This is a reland of 325b492fe733ba4c8b2128069a0a232fea1789e3

Initialize tail_time_ in constructor so we don't have uninitialized
variable.

Original change's description:
> WaveShaper must output non-zero values even if input is silent
>
> If the curve for the WaveShaperNode is such that a zero input produces
> a non-zero output, the WaveShaperNode needs to output that value even
> if the input is silent (or disconnected).
>
> Do this by setting the tail time of the processor to 0 or infinity
> depending on whether the curve specifies an output value of zero or
> not, respectively.
>
> Bug: 807301
> Test: WaveShaper/silent-inputs.html
> Change-Id: I6539d2e00f5d3e624ffaf2810944eb6d53d6f84b
> Reviewed-on: https://chromium-review.googlesource.com/896266
> Commit-Queue: Raymond Toy <rtoy@chromium.org>
> Reviewed-by: Hongchan Choi <hongchan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#564186}

Bug: 807301
Change-Id: I866c5b303b40c1245d86daf43c592eed39d6a9c9
Reviewed-on: https://chromium-review.googlesource.com/1087427
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564630}
[add] https://crrev.com/be0ac4b3ec4972e8c6297fc0700f625da46c5bf0/third_party/WebKit/LayoutTests/external/wpt/webaudio/the-audio-api/the-waveshapernode-interface/silent-inputs.html
[modify] https://crrev.com/be0ac4b3ec4972e8c6297fc0700f625da46c5bf0/third_party/blink/renderer/modules/webaudio/wave_shaper_dsp_kernel.cc
[modify] https://crrev.com/be0ac4b3ec4972e8c6297fc0700f625da46c5bf0/third_party/blink/renderer/modules/webaudio/wave_shaper_dsp_kernel.h
[modify] https://crrev.com/be0ac4b3ec4972e8c6297fc0700f625da46c5bf0/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.cc

Status: Assigned (was: Available)

Sign in to add a comment