F
是载体,E
和D
是调制器。
使用仅一个调制器进行简单的FM合成,在webaudio中非常简单。
var ctx = new AudioContext || webkitAudioContext();
var out = ctx.destination;
// Instantiating
var E = ctx.createOscillator(); // Modulator
var F = ctx.createOscillator(); // Carrier
// Setting frequencies
E.frequency.value = 440;
F.frequency.value = 440;
// Modulation depth
var E_gain = ctx.createGain();
E_gain.gain.value = 3000;
// Wiring everything up
E.connect(E_gain);
E_gain.connect(F.frequency);
F.connect(out);
// Start making sound
E.start();
F.start();
但现在我想做出类似的事情。
两个调制器即是。如何在webaudio中实现?
答案 0 :(得分:0)
响应: 你需要连接到失谐而不是频率。
实施例: 嘿,我在我的网站上有一个例子给你: http://gtube.de/
转到头部的发布区域并选择FM合成器。
在那里你可以看到连接,你可以试一试(使用键盘A-L)! : - )
Exampleobject:
{"name":"connection","Name":"Connection at Pos6","ConnectFrom":"1_#_MOD 1_#_object","ConnectTo":"3_#_GAIN MOD1_#_object"},
{"name":"connection","Name":"Connection at Pos7","ConnectFrom":"3_#_GAIN MOD1_#_object","ConnectTo":"0_#_OSC_#_detune"},
{"name":"connection","Name":"Connection at Pos8","ConnectFrom":"2_#_MOD 2_#_object","ConnectTo":"4_#_GAIN MOD2_#_object"},
{"name":"connection","Name":"Connection at Pos9","ConnectFrom":"4_#_GAIN MOD2_#_object","ConnectTo":"0_#_OSC_#_detune"}
{"name":"connection","Name":"Connection at Pos10","ConnectFrom":"0_#_OSC_#_object","ConnectTo":"5_#_GAIN OSC_#_object"},
{"name":"connection","Name":"Connection at Pos11","ConnectFrom":"5_#_GAIN OSC_#_object","ConnectTo":"context.destination"}]