【发布时间】:2015-03-25 07:49:16
【问题描述】:
使用网络音频 API,我想平移声音(使用 PannerNode),然后将声音输入 ChannelSplitterNode,这样我就可以将 AnalyserNode 应用到每个通道。
但是,ChannelSplitterNode 取消了由早期 PannerNode 创建的平移。
这个gist 说明了我的问题。篇幅较长,但我们可以关注panAndPlay方法:
// Pans and plays a sound.
function panAndPlay(source) {
// Specify a pan.
var panner = audioContext.createPanner();
panner.panningModel = 'equalpower';
panner.setPosition(1, 0, 0);
// Create a splitter node that is supposed to split by channel.
var splitter = audioContext.createChannelSplitter();
// Create the audio graph: source -> panner -> splitter -> destination
source.connect(panner);
panner.connect(splitter);
// Try to hook up both channels outputted by the splitter to destination.
splitter.connect(audioContext.destination, 0);
splitter.connect(audioContext.destination, 1);
// The splitter seems to ignore the pan: You only hear the pan effect if you
// bypass the splitter by directly connecting the panner to the
// destination. Why does the splitter remove the pan effect? I want to use
// a splitter so that I can hook up an analyzer node to each channel, but
// I also want the pan effect ...
// Start playing sound.
source.start(0);
};
如何让分配器在其通道输出中注意早期的声像效果?
【问题讨论】:
标签: web-audio-api