2016-04-20 58 views
0

F是載體,並且ED是調製劑。具有兩個調製器的Webaudio FM Synthesis合成

FM Synthesis with one modulator

簡單的FM合成只有一個調製器,是webaudio非常簡單。

FM Synthesis with one modulator

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(); 

但現在我想作這樣的事情。

FM Synthesis with two modulators

兩個調製器即是。這在webaudio中如何實現?

回答

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"}] 
+0

這似乎並不在目前的Chrome瀏覽器的工作。控制檯顯示'TypeError:無法讀取HTMLDocument.document.onkeydown(app.js:5518)未定義的 屬性'detune' – brainjam

+0

請選擇鍵盤A-L輸入而不是Midi輸入。 –