且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何做单声道到立体声转换?

更新时间:2022-04-21 22:08:23

实施一个正确实施平移单声道信号转换为立体声场。如果您平移,而是一路向左或向右所有你想要的方式就好像它在中间被平移的信号强度是一样的,所以声像被设定为离开将是:

The implementation is one correct implementation of "panning" a mono signal into a stereo field. If you pan, instead all the way left or all the way right you want the signal strength to be the same as if it had been panned in the middle, so panned left would be:

//left panning
leftSample = sourceSample;
rightSample = 0;
//right panning
leftSample = 0;
rightSample = sourceSample;
//center panning (same power as hard left/right conversion/)
leftSample = sourceSample * sqrt(2)/2;
rightSample = sourceSample * sqrt(2)/2;

不过,如果你是从单声道转换为立体声,你的直觉是正确的。没有任何理由降低水平,因为你不会直接比较集中,以平移信号。去***的办法是离开满员信号:

However, if you are converting from mono to stereo, your intuition is correct. There no reason to lower the level since you wont be comparing centered to panned signals. The best way to go is to leave the signal at full strength:

//mono to stereo conversion
leftSample = sourceSample;
rightSample = sourceSample;

这也有可能是他们留下一些后S / R转换增益变化,但水平显得随意。

It's also possible that they are leaving some post-s/r conversion gain change, but the level seem arbitrary.