[linux-audio-dev] Mixing signals

Viceic Predrag viceic at net2000.ch
Mon May 23 08:45:51 UTC 2005


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





More information about the Linux-audio-dev mailing list