[linux-audio-dev] Mixing signals

Richard Spindler richard.spindler at gmail.com
Mon May 23 09:03:30 UTC 2005

On 5/23/05, Viceic Predrag <viceic at net2000.ch> wrote:
> Could someone please help with this apparently simple problem?

I'm not a "professional" either, but this is what I do:

unsigned int TLData::MixChannels(float *A, float *B, float* out,
unsigned int   count)
  /*Mix function for (-1)-(1) float audio*/
        unsigned int i;
        float *p_output = out;
        float *p_A = A;
        float *p_B = B;
        for ( i=count; i > 0;i--){
                if (*p_A<0 && *p_B<0) {
                        *p_output =(*p_A+1)*(*p_B+1)-1;
                } else {
                        *p_output =2*(*p_A+*p_B+2)-(*p_A+1)*(*p_B+1)-3;

        return count;

It works for me :)


More information about the Linux-audio-dev mailing list