Reputation: 690
I can't seem to get the GainNode to work. I'm running this code in JSFiddle and it still produces a tone even though gain is set to 0.
var context = new webkitAudioContext();
var gain = context.createGain();
gain.value = 0;
var oscillator = context.createOscillator();
oscillator.type = oscillator.SINE;
oscillator.frequency.value = 444;
oscillator.connect(gain);
gain.connect(context.destination);
oscillator.start(0);
Upvotes: 1
Views: 233
Reputation: 13928
You should say "gain.gain.value = 0". gain is a GainNode, which contains a single AudioParam named "gain".
Upvotes: 2