我似乎无法让GainNode工作。我在JSFiddle中运行此代码,即使增益设置为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);
答案 0 :(得分:2)
你应该说" gain.gain.value = 0"。 gain是一个GainNode,它包含一个名为" gain"的单个AudioParam。