- From: Ray Bellis <ray@bellis.me.uk>
- Date: Tue, 13 Nov 2012 19:43:21 +0000
- To: public-audio@w3.org
On 06/11/2012 16:42, Ray Bellis wrote:
> This works on Chrome 25.0.1317.0 canary but doesn't work on Chrome 22 -
> the node's "playBackState" appears stuck in "scheduled" even though I
> called "node.noteOn(0)".
The problem I reported last week persists in Chrome 23, but I've found
that it's not related directly to my "Unity Source Node". It's also
present in Safari 6.0.x
My set up code is below:
// WebAudio set up
var ctx = this.ctx = new webkitAudioContext();
// Main Audio chain
// NB: filters doubled to provide original 24dB/octave cutoff
var osc = this.osc = ctx.createOscillator();
var vcaenv = this.vcaenv = ctx.createGainNode();
var filter1 = this.filter1 = ctx.createBiquadFilter();
var filter2 = this.filter2 = ctx.createBiquadFilter();
var master = this.master = ctx.createGainNode();
var mute = this.mute = ctx.createGainNode();
osc.connect(filter1);
filter1.connect(filter2);
filter2.connect(vcaenv);
vcaenv.connect(master);
master.connect(mute);
mute.connect(ctx.destination);
// VCF chain
var unity = this.unity = ctx.createUnitySource();
var vcfenv = this.vcfenv = ctx.createGainNode();
var vcfgain = this.vcfgain = ctx.createGainNode();
unity.connect(vcfenv);
vcfenv.connect(vcfgain);
vcfgain.connect(filter1.frequency);
vcfgain.connect(filter2.frequency);
The primary chain is all audio: oscillator -> VCA EG -> Filters * 2 ->
Master Volume -> Audio On/Off
The secondary chain is there to allow an envelope to be applied to the
two filters. The filters have a base frequency, and then the VCF EG is
multiplied by a gain node set to the same frequency as the filters and
then also connected to the filters. The effect _should_ be that when
the VCF EG is at "1" the filter cutoff goes up by one octave.
But - the unity node _never_ leaves "scheduled" state. I tried
replacing the AudioBufferNode it's built from with a standard oscillator
and I get the same behaviour.
*However* - if I add:
vcfgain.connect(osc.frequency);
at the end, it all starts (but of course doesn't sound right).
It looks like something is confusing the node graph, but I can't tell
what. I've looked on the WebKit bugzilla and can't find any fixes that
look related, although it does appear fine in Chrome 25. I'd really
like to get this up and working on standard releases of Chrome and
Safari so I can finish the project and release it.
Any ideas?
thanks,
Ray
Received on Tuesday, 13 November 2012 19:43:47 UTC