New issue
Advanced search Search tips

Issue 631576 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Oscillator.start(t) incorrectly sampled

Project Member Reported by rtoy@chromium.org, Jul 26 2016

Issue description


OS: All

What steps will reproduce the problem?
(1) Run the following in hoch.github.com/canopy

// @channels 1
// @duration 1.0
// @sampleRate 12800


var osc = context.createOscillator();
var quarterWaveDelay = 1 / (4 * osc.frequency.value);
console.log(quarterWaveDelay);

osc.connect(context.destination);

osc.start(quarterWaveDelay);

(2) Zoom in the waveform to show time between 0 and 0.002 (or so)
(3) Examine the waveform value at frame 8

The displayed value for frame 8 is 0.2143.

However, a quarter wave delay is 1/1760 sec, or about 7.2727 frames. If the oscillator actually started there, the waveform value at frame 8 would not be 0.2143.  It should be closer to 0.1564.  Why?

The waveform should be sin(2*pi*f*(t-t0)) where the frequency f is 440 Hz and t0 = 1/1760 sec.  The sample for frame 8 corresponds to t = 8/12800.  Thus the true value should be sin(pi/20) = 0.156.
 

Comment 1 by rtoy@chromium.org, Jul 26 2016

The value that is actually displayed corresponds to sin(2*pi*440*1/12800) = sin(11*pi/160) = 0.2143.

Comment 2 by rtoy@chromium.org, Jul 27 2016

Also see the examples in https://github.com/WebAudio/web-audio-api/issues/915
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 10 2017

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

commit 7909df464ca46a1ea121b0c54e5d04cfa521e38c
Author: rtoy <rtoy@chromium.org>
Date: Tue Jan 10 20:17:26 2017

Sub-sample accurate start of OscillatorNode

Previously, an oscillator would start at the nearest sample frame
boundary.  This can produce noticeable effects.

Instead, make the oscillator start at the requested sample time and
sample the curve appropriately.

BUG= 631576 
TEST=Oscillator/start-sampling.html

Review-Url: https://codereview.chromium.org/2186813003
Cr-Commit-Position: refs/heads/master@{#442669}

[add] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/LayoutTests/webaudio/Oscillator/start-sampling.html
[modify] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js
[modify] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js
[modify] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp
[modify] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp
[modify] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h
[modify] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.cpp
[modify] https://crrev.com/7909df464ca46a1ea121b0c54e5d04cfa521e38c/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp

Project Member

Comment 4 by bugdroid1@chromium.org, Jan 11 2017

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

commit 30ffb0ffee307ed4f236bd3df8398bf0c1b107c4
Author: timloh <timloh@chromium.org>
Date: Wed Jan 11 00:21:38 2017

Revert of Sub-sample accurate start of OscillatorNode (patchset #11 id:200001 of https://codereview.chromium.org/2186813003/ )

Reason for revert:
Added test is failing on WebKit Mac10.11 (retina)

https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Mac10.11%20%28retina%29

Original issue's description:
> Sub-sample accurate start of OscillatorNode
>
> Previously, an oscillator would start at the nearest sample frame
> boundary.  This can produce noticeable effects.
>
> Instead, make the oscillator start at the requested sample time and
> sample the curve appropriately.
>
> BUG= 631576 
> TEST=Oscillator/start-sampling.html
>
> Review-Url: https://codereview.chromium.org/2186813003
> Cr-Commit-Position: refs/heads/master@{#442669}
> Committed: https://chromium.googlesource.com/chromium/src/+/7909df464ca46a1ea121b0c54e5d04cfa521e38c

TBR=hongchan@chromium.org,rtoy@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 631576 

Review-Url: https://codereview.chromium.org/2623063002
Cr-Commit-Position: refs/heads/master@{#442739}

[delete] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/LayoutTests/webaudio/Oscillator/start-sampling.html
[modify] https://crrev.com/30ffb0ffee307ed4f236bd3df8398bf0c1b107c4/third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js
[modify] https://crrev.com/30ffb0ffee307ed4f236bd3df8398bf0c1b107c4/third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js
[modify] https://crrev.com/30ffb0ffee307ed4f236bd3df8398bf0c1b107c4/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp
[modify] https://crrev.com/30ffb0ffee307ed4f236bd3df8398bf0c1b107c4/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp
[modify] https://crrev.com/30ffb0ffee307ed4f236bd3df8398bf0c1b107c4/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h
[modify] https://crrev.com/30ffb0ffee307ed4f236bd3df8398bf0c1b107c4/third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.cpp
[modify] https://crrev.com/30ffb0ffee307ed4f236bd3df8398bf0c1b107c4/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp

Project Member

Comment 5 by bugdroid1@chromium.org, Jan 11 2017

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

commit 607f279225fce413a8f6f5247540494b969dd612
Author: rtoy <rtoy@chromium.org>
Date: Wed Jan 11 23:01:10 2017

Sub-sample accurate start of OscillatorNode

Previously, an oscillator would start at the nearest sample frame
boundary.  This can produce noticeable effects.

Instead, make the oscillator start at the requested sample time and
sample the curve appropriately.

BUG= 631576 
TEST=Oscillator/start-sampling.html

Review-Url: https://codereview.chromium.org/2186813003
Cr-Original-Commit-Position: refs/heads/master@{#442669}
Committed: https://chromium.googlesource.com/chromium/src/+/7909df464ca46a1ea121b0c54e5d04cfa521e38c
Review-Url: https://codereview.chromium.org/2186813003
Cr-Commit-Position: refs/heads/master@{#443040}

[add] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/LayoutTests/webaudio/Oscillator/start-sampling.html
[modify] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js
[modify] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/LayoutTests/webaudio/resources/audit-util.js
[modify] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp
[modify] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp
[modify] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h
[modify] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.cpp
[modify] https://crrev.com/607f279225fce413a8f6f5247540494b969dd612/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp

Comment 6 by rtoy@chromium.org, Jan 13 2017

Owner: rtoy@chromium.org
Status: Fixed (was: Available)

Sign in to add a comment