我尝试使用来自慢速振荡器saw
的脉冲调制sine
频率。我究竟做错了什么? jsFiddle这里:https://jsfiddle.net/06ua9zLo/
window.AudioContext = window.AudioContext||window.webkitAudioContext;
var context = new AudioContext();
var saw = context.createOscillator(),
sine = context.createOscillator(),
sineGain = context.createGain();
//set up our oscillator types
saw.type = 'sawtooth';
sine.type = 'sine';
//set the amplitude of the modulation
sineGain.gain.value = 10;
//connect the dots
sine.connect(sineGain);
sineGain.connect(saw.frequency);
saw.connect(context.destination);
sine.start();
saw.start();
答案 0 :(得分:3)
您的设置很好。只需尝试改变调制器的频率并增加一点增益,你就会发现你实际上在做FM。例如:
sine.frequency.value = 15;
sineGain.gain.value = 100;
肯定会告诉你它有效。