我正在使用带有 javascript 的 Web Audio API。
我创建一个振荡器,将其连接到卷(gainNode),然后将其连接到目的地。
好的。不错。
我想要一个延迟效果,我把它放在振荡器和音量之间。
嗯,这不起作用,我只听到延迟。虽然,很干净。
好的,所以我将 osc 连接到延迟到音量,然后将 osc 连接到音量,然后将音量连接到目标。
现在看来是扭曲了。
我尝试使用 osc 延迟将卷发送到目的地,使用 osc 发送到目的地,以便有两个到目的地的连接。这也被扭曲了。
这是在 Chrome 上。
在我尝试的一小段时间里,它似乎在 iOS6 上运行得很好。不知道Safari。
访问 http://cloudmusiccompany.appspot.com/watch.jsp 进行尝试然后单击红色并绘图。这是一个普通的正弦振荡器。现在单击白色并绘制,这与延迟相同,并且在 chrome (Ubuntu) 上它是扭曲的。不知道萨法尔。
显然,您可以在链接中看到完整的源代码,因为它是 javascript。
相关来源:
function makeNewChannel(color){
var info = getInstrumentInfo(color);
var chan = {osc: acontext.createOscillator(),
freqs: [],
times: [],
pxdata: [],
i: 0,
muted: true,
finishedLoop: false,
volume: acontext.createGainNode(),
gate: acontext.createGainNode(),
delay: acontext.createDelayNode(),
delayGain: acontext.createGainNode(),
mute: function(){
this.muted = true;
this.volume.gain.value = 0;
},
unmute: function(){
this.muted = false;
this.volume.gain.value = player.defaultGain / (info.soft ? 2 : 1);
}
}
chan.osc.type = info.type;
// chan.osc.connect(chan.gate);
chan.osc.connect(chan.volume);
chan.delayGain.gain.value = player.defaultGain ;
/* ugh , the wet sounds ok, but somehow its distorting or doubling the dry signal
* although it seems ok on iphone?
* */
if (info.delay){
chan.delay.delayTime.value = 0.5;
chan.volume.connect(chan.delay)
chan.delay.connect(chan.delayGain);
chan.delayGain.connect(acontext.destination);
}
chan.volume.gain.value = 0; //player.defaultGain;
chan.gate.gain.value = 0;
chan.volume.connect(acontext.destination);
chan.osc.frequency.value = 0;
chan.osc.noteOn(0);
return chan;
}
最佳答案
我刚刚有机会在 Windows 上的 Chrome 上使用它,并且运行良好。延迟听起来应该是这样。
这一定是 Linux 版本(chrome)中的错误
关于javascript - Chrome 中的 Web Audio API 延迟声音失真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13080260/