问题描述
是否有一种(简单的)方法来获取单声道输入并仅在左声道或右声道中播放?我想我可以通过 ScriptProcessing 节点来完成,但是如果有一个节点可以处理这种情况,我真的很想知道.API 有一个关于混音的部分,但我没有看到任何关于如何以这种方式自己操作频道的代码.
Is there an (easy) way to take a mono input and play it only in the left or right channel? I'm thinking I can do it through the ScriptProcessing node, but if there is a node meant to handle this situation I'd really like to know. The API has a section on mixing, but I don't see any code on how to manipulate channels yourself in this fashion.
注意,我已经尝试了 panner 节点,但它似乎并没有真正切断左声道和右声道,我不希望任何声音从一个声道流到另一个声道.
Note, I have tried the panner node, but it doesn't seem to really cut off the left the from the right channel, I don't want any sound bleeding from one channel to the other.
推荐答案
您确实希望使用 ChannelSplitter,尽管在根本没有连接通道时会出现错误.请参阅此问题:在单通道中播放振荡.
You do want to use the ChannelSplitter, although there is a bug when a channel is simply not connected. See this issue: Play an Oscillation In a Single Channel.
这篇关于Web Audio API:如何仅在左声道或右声道中播放单声道源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!