开发者

how to mix two audio channels?

开发者 https://www.devze.com 2023-02-02 01:36 出处:网络
I have two mono audio channels (pcm format) of audio call, incoming and outgoing. how to mix them? how to position t开发者_高级运维hem in space? (e.g. incoming channel sounds slightly on the left and

I have two mono audio channels (pcm format) of audio call, incoming and outgoing. how to mix them? how to position t开发者_高级运维hem in space? (e.g. incoming channel sounds slightly on the left and outgoing on the right)


Mixing is just a weighted addition of both signals. So if you want them to be equal in one mono signal, lower both signals by a factor of 2 and add them. If you want to position them in the stereo space, use different weighting on the left and right channel. For example 0.6 of signal 1 and 0.4 of signal 2 on the left channel and vice versa on the right channel will do the trick. For better results, a slight timeshift would be necessary, but that depends on your needs.


Stereo PCM is just left and right interleaved, first all the bytes for one sample of the left channel then all the bytes for one sample on the right channel.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号