1

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);
tompreston
  • 630
  • 7
  • 24

1 Answers1

2

You should say "gain.gain.value = 0". gain is a GainNode, which contains a single AudioParam named "gain".

cwilso
  • 13,610
  • 1
  • 30
  • 35