I have extended "libtinyalsa" (a very small version of ALSA) with a method to resample in- & outgoing PCM-audio (with libresample, e.g. from 48 kHz to 44.1 kHz).
Now I would like to extend it with a "downMixing" (is that the right word?) method.
I have 5.1 channel PCM and just need 2 channel stereo audio (left & right):
I have no real knowledge about C and PCM - simple answers would be really welcome.
With kind regards & thanks in advance!
I believe downmixing a 5.1 PCM stream to stereo could be done something like this:
L = clamp((FL + RL + C*0.708 + LFE*0.708) / 2)
R = clamp((FR + RR + C*0.708 + LFE*0.708) / 2)
You can refer e.g. to the downmix effect in Android for an example of this.
Or just select two of the channels that you will keep (e.g. FL and FR) and skip past the samples from the other channels.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With