How to downmix 5.1 and 7.1 channels to 2 channels

Ricard Wanderlof ricardw at axis.com
Wed Oct 21 15:57:50 CEST 2020


On Tue, 20 Oct 2020, Amanda Ava Koci Pereira wrote:

> Hi guys...
> 
> We need some clues about to downmix 5.1 and 7.1 channels to 2 channels
> 
> for the moment we are using the following code ->
> 
> It works but fails miserably if all channels have data at same time
> 

Is the problem that you get clipping if there is audio on more than one 
input channel?

In general, if you sum a number (N)( of digital channels which have a 
maximum amplitude of M, then the maximum amplitude of the sum will be N * 
M. So in this case you need to reduce the output amplitude by 1/N if you 
want to keep the maximum amplitude of the sum at M.

So in your case you need to set 

> #define AR_K_P_ATTENUATION_LEVEL 1.0

according to the number of channels being downmixed per output channel.

/Ricard
-- 
Ricard Wolf Wanderlof                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30


More information about the Alsa-devel mailing list