WebAudio 调频调制
WebAudio FM modulation
我正在尝试使用来自慢速振荡器 sine
的脉冲来调制 saw
频率。我究竟做错了什么? 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();
您的设置没问题。只需尝试改变调制器的频率并增加一点增益,您就会发现实际上是在调频。例如:
sine.frequency.value = 15;
sineGain.gain.value = 100;
肯定会告诉你它有效。
我正在尝试使用来自慢速振荡器 sine
的脉冲来调制 saw
频率。我究竟做错了什么? 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();
您的设置没问题。只需尝试改变调制器的频率并增加一点增益,您就会发现实际上是在调频。例如:
sine.frequency.value = 15;
sineGain.gain.value = 100;
肯定会告诉你它有效。