windows 如何混合两个音频通道?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4567096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:52:50  来源:igfitidea点击:

how to mix two audio channels?

c++windowsaudiomixer

提问by Andriy Tylychko

I have two mono audio channels (pcm format) of audio call, incoming and outgoing. how to mix them? how to position them in space? (e.g. incoming channel sounds slightly on the left and outgoing on the right)

我有两个音频呼叫的单声道音频通道(pcm 格式),传入和传出。如何混合它们?如何在空间中定位它们?(例如,传入通道在左侧略有声音,在右侧略有传出)

采纳答案by groovingandi

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.

混合只是两个信号的加权相加。因此,如果您希望它们在一个单声道信号中相等,请将两个信号降低 2 倍并将它们相加。如果要将它们放置在立体声空间中,请在左右声道上使用不同的权重。例如,左声道上信号 1 的 0.6 和信号 2 的 0.4 以及右声道上的反之亦然。为了获得更好的结果,需要稍微进行时移,但这取决于您的需要。

回答by BrokenGlass

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.

立体声 PCM 只是左右交错,首先是左声道一个样本的所有字节,然后是右声道一个样本的所有字节。