Web Audio API: Pan audio (left/right) + controlling gain

不问归期 提交于 2019-12-25 16:29:43

问题


I want to create a very basic AudioContext()-instance playing a sound either on the left or on the right channel.

I know, there is already an answer about this here: https://stackoverflow.com/a/20850704/1138860

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.

I extended the original Example from the answer with a GainNode: http://jsbin.com/cofiwugeca/4/edit?js,output


回答1:


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.



来源:https://stackoverflow.com/questions/28111136/web-audio-api-pan-audio-left-right-controlling-gain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!