[linux-audio-dev] Mixing signals

From: Viceic Predrag <viceic@email-addr-hidden>
Date: Mon May 23 2005 - 11:45:51 EEST

Hi all,

I'm the author of Freecycle, one of the younger FOSS audio projects out there.
I have a problem that may astound by it's simplicity, so I barely dare to ask
for help...

Freecycle provides some LADSPA functionality, and as there are lot of great
but mono ladspa effects, I need a very simple way of sending stereo audio to
mono input..

As I want to make my software as simple as possible for the end user, I
provide some basic routing for the LADSPA giving the possibility to enter
LADSPA input audio port either from the left channel, either from the right
channel either from the mix of two channels. The signal is then passed
through LADSPA and every 1024 frames the LADSPA control port input values are
changed according to the desired automation.

My problem consists in a correct way of mixing the two channels into one. I
have found 4 ways of doing that:

1) sum L and R and divide by 2 : well..

2) if L>0 and R>0 take the max, if L<0 and R<0, take the min, else add. :
current implementation

3) add, and then normalize to the max after summation.

The way that "feels" most correct to me is 3), but I don't like the two pass
approach, as I mix the channels every 1024 frames and the send those 1024
frames to LADSPA.

Of course, I would like to avoid letting the user set the gains manually...

Could someone please help with this apparently simple problem?

Many thanks,

Predrag Viceic
http://www.redsteamrecords.com/freecycle
Received on Mon May 23 12:15:06 2005

This archive was generated by hypermail 2.1.8 : Mon May 23 2005 - 12:15:07 EEST