Nodes connection order seems to be important
Megaemce opened this issue · 3 comments
Hello team. I'm debugging my own app (mobbler) and while doing so I noticed strange bug. I have a vibrato effect with custom audioNode-like property:
module.audioNode = {
delayNode: new DelayNode(audioContext, { delayTime: delayTime }),
inputNode: new GainNode(audioContext),
outputNode: new GainNode(audioContext),
depthNode: new GainNode(audioContext, { gain: width }),
oscillatorNode: new OscillatorNode(audioContext, { type: "sine", frequency: speed }),
get speed() {
return this.oscillatorNode.frequency;
},
get width() {
return this.depthNode.gain;
},
connect(destination) {
if (destination.inputNode) this.outputNode.connect(destination.inputNode);
else this.outputNode.connect(destination);
},
disconnect() {
this.outputNode.disconnect();
},
};
};
module.audioNode.inputNode.connect(module.audioNode.delayNode);
module.audioNode.delayNode.connect(module.audioNode.outputNode);
module.audioNode.oscillatorNode.connect(module.audioNode.depthNode);
module.audioNode.depthNode.connect(module.audioNode.delayNode.delayTime);
module.audioNode.oscillatorNode.start(0);and that's giving below result:

where, when I reorder one line (for example oscillatorNode > depthNode) like so:
module.audioNode.inputNode.connect(module.audioNode.delayNode);
module.audioNode.delayNode.connect(module.audioNode.outputNode);
module.audioNode.depthNode.connect(module.audioNode.delayNode.delayTime);
module.audioNode.oscillatorNode.connect(module.audioNode.depthNode); // just one line downand that's even worse when connection-train looks like so:
module.audioNode.depthNode.connect(module.audioNode.delayNode.delayTime);
module.audioNode.inputNode.connect(module.audioNode.delayNode);
module.audioNode.oscillatorNode.connect(module.audioNode.depthNode);
module.audioNode.delayNode.connect(module.audioNode.outputNode);then the whole audion section looks just weird:

I can tell that order doesn't impact web audio itself - effect works just fine. It's just an audion issue which seems to be looking at the order of connection train (which - IMO - should not be important at all)
Another thing worth looking at is why DelayNode is not showing it's delayTime audioParam in this chart.
Thanks for the detailed bug reporting. We'll be picking up this project soon (Q1 2022) and address bugs filed in the tracker.
Can you try against the current main branch? I am not sure how to reproduce this issue on your app.
When I tried the "vibrato effect" on the app, now I see a different graph from the first screenshot in the report.
That seems to be working better now. Thank you
