alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Ricard Wanderlof <ricardw@axis.com>
To: Amanda Ava Koci Pereira <arsoftware10@gmail.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: How to downmix 5.1 and 7.1 channels to 2 channels
Date: Wed, 21 Oct 2020 15:57:50 +0200	[thread overview]
Message-ID: <alpine.DEB.2.21.2010211554200.22113@lnxricardw1.se.axis.com> (raw)
In-Reply-To: <CALAz8EWAKP-LaeDyQZW0BauwYBthSbgJgxRT8hypuXEWEOfPhA@mail.gmail.com>


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

  reply	other threads:[~2020-10-21 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  2:32 How to downmix 5.1 and 7.1 channels to 2 channels Amanda Ava Koci Pereira
2020-10-21 13:57 ` Ricard Wanderlof [this message]
2020-10-22  9:11   ` Amanda Ava Koci Pereira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2010211554200.22113@lnxricardw1.se.axis.com \
    --to=ricardw@axis.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arsoftware10@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).