New issue
Advanced search Search tips

Issue 884490 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

When there is a loop in the WebAudio graph Chromium adds a delay under the hood

Reported by micbu...@gmail.com, Sep 15

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36

Steps to reproduce the problem:
Run this example in https://hoch.github.io/canopy :

let s0 = new ConstantSourceNode(context);
let f = new GainNode(context);
let g = new GainNode(context, {gain: -0.5});
s0.connect(f).connect(context.destination);
f.connect(g).connect(f);
s0.start(); 

What is the expected behavior?
No delay should be noticeable, and in addition, nothing should be rendered as making a loop without an explicit delay is against the specification. This code breaks in FireFox for example. It works in Chrome but there is a delay that has been added under the hood.

This is a problem as in our applications (a guitar tube amp simulator) we use a negative feedback loop in the power amp stage simulation, and if we do not add a delay, the audio graph is not rendered in FF and no sound can be heard, if we add a delay, it renders as expected in FF but the sound is different in Chromium because of the extra delay added.

Our guitar amp simulation can be tried at https://mainline.i3s.unice.fr/AmpSim4/ select the preset metal 1 for example, and use the audio player on the left to send a guitar sound sample to the amp. The same operation gives a different sound between FF and Chrome.

What went wrong?
The output is a bunch of stairsteps, changing every 128 frames. An extra delay is being added at each iteration of the loop.

FF implements things here according to the spec.  And if you add a delay node into the loop and set the delay to < 128, the delay is 128.
If you look at chrome's output, it's constant for the first 128, then drops to 0.5 for the next 128.  This equivalent to delaying the feedback signal 128 frames.  Always.
If you then add a delay node to the feedback loop with a delay of 128, the stairsteps are now 256 samples long.

Discussion on slack with Raymond Toy : "We've been reluctant to fix this because it requires traversing the graph everytime a connection is made (or broken).  I think it's time to fix this."

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 69.0.3497.92  Channel: stable
OS Version: OS X 10.12.6
Flash Version: 

As Raymond said : "maybe it's time to fix this.... we've got more and more use cases where loops are required to implement some electronic audio schema simulations"
 
Labels: Needs-Triage-M69
Status: Available (was: Unconfirmed)
Yeah, we really do need to fix this.

Sign in to add a comment