Web Audio API:平移音频(左/右)+控制增益 [英] Web Audio API: Pan audio (left/right) + controlling gain
问题描述
我想创建一个非常基本的AudioContext()实例,在左或右声道上播放声音.
I want to create a very basic AudioContext()-instance playing a sound either on the left or on the right channel.
我知道,这里已经有关于此的答案: https://stackoverflow.com/a/20850704/1138860
I know, there is already an answer about this here: https://stackoverflow.com/a/20850704/1138860
我的问题是,我必须通过GainNode控制增益.
每当我连接GainNode时,它都会使左右声道再次输出声音.
My problem is, I have to control the gain via a GainNode.
Whenever I conntect the GainNode, it makes the left/right channel to output sound again.
我从GainNode的答案中扩展了原始示例: a href ="http://jsbin.com/cofiwugeca/4/edit?js,output" rel ="nofollow noreferrer"> http://jsbin.com/cofiwugeca/4/edit?js,output
I extended the original Example from the answer with a GainNode: http://jsbin.com/cofiwugeca/4/edit?js,output
推荐答案
似乎将源连接到增益节点,然后将增益节点直接连接到目标.因此,现在您的源通过平移器和增益节点到达目的地.将您的增益节点连接到Panner而不是目的地.我认为这可以解决.
It looks like you connect the source to the gain node and then connect the gain node directly to the destination. So now your source is gets to the destination via the panner and the gain node. Connect your gain node to the panner instead of the destination. I think that will fix it.
这篇关于Web Audio API:平移音频(左/右)+控制增益的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!