Closed Bug 1520576 Opened 7 years ago Closed 7 years ago

Incorrect output from AudioParam automation

Categories

(Core :: Web Audio, defect)

57 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1520577

People

(Reporter: toy.raymond, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.53 Safari/537.36

Steps to reproduce:

Run this snippet using hoch.github.io/canopy:

// @sampleRate 65536
// @duration 0.125

const src = new ConstantSourceNode(context);
src.connect(context.destination);

const time1 = 0
const time2 = 1.401298464324817e-45
src.offset.setValueAtTime(10, time1);
src.offset.linearRampToValueAtTime(Math.fround(3.4028235e38), time2);

src.start();

Actual results:

Zoom in on the graph and examine the value at time 0. It is 3.4e38.

Expected results:

The value at time 0 should be 0.

There's a setValue at time 0, and the linear ramp ends at time 1.4e-45. Thus at time 0, the output should be 0, provided by the setValue. Then at frame 1, it should be 3.4e38.

In fact with time2 = 1e-6, the output is not 0, but it is at 1e-5. This is suspiciously close to the frame time (1/65536 = 1.5e-5).

Pretty minor bug.

I am seeing consistent behavior between 66 and other browsers.

Using the following specs:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0
Version 66.0a1
Build ID 20190121113514

If you are seeing abnormal behavior, please provide a screenshot of the discrepancy.

Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Component: Untriaged → JavaScript Engine
Flags: needinfo?(toy.raymond)
Product: Firefox → Core
Resolution: --- → WORKSFORME
Component: JavaScript Engine → Web Audio

Ok. Paste the following into the dev console:

context = new OfflineAudioContext(1, 256, 65536)
// @sampleRate 65536
// @duration 0.125

const src = new ConstantSourceNode(context);
src.connect(context.destination);

const time1 = 0
const time2 = 1.401298464324817e-45
src.offset.setValueAtTime(10, time1);
src.offset.linearRampToValueAtTime(Math.fround(3.4028235e38), time2);

src.start();

context.startRendering().then(buffer => console.log(buffer.getChannelData(0)))

The log shows

Float32Array(256) [ 3.4028234663852886e+38, 3.4028234663852886e+38, ...

This is incorrect for the reasons given in the original. The value for the first element of the Float32Array must be 10, because of the setValueAtTime(10, time1) (time1 = 0) and because time2 > time1, so the end of the ramp occurs after time1.

(My mistake in the original snippet. The output should be 10, not 0.)

Flags: needinfo?(toy.raymond)

Thanks for the examples. This will be the same issue as bug 1520577, and so we can track it there.

Resolution: WORKSFORME → DUPLICATE
You need to log in before you can comment on or make changes to this bug.