[linux-audio-dev] Surround panning algorithm

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] Surround panning algorithm
From: Greg Lee (greg_AT_ling.lll.hawaii.edu)
Date: Wed Jun 16 2004 - 03:30:43 EEST


I need to do surround panning for a couple of applications.
The following is what I have so far. it's not principled
or analytical --- I just made it up this morning off the
cuff. I'm hoping some of you will have suggestions. Pointers
to sample code for better versions would be nice.

/*
  * "pan" is midi pan, 0 (left) to 127 (right)
  * "speaker" is 0 (left surround), 32 (left front),
  * 64 (center), 95 (right front), 128 (right surround)
  * "separation" is 95 for 4-channel surround (left
  * front and right front taper down to 0 amplitude
  * at right pan=127 and left pan=0, respectively).
  * and is 64 for 6-channel surround (center tapers
  * down to 0 amplitude at left and right).
  *
  * Returns amplitude 0-127 for requested speaker.
  */
static int panf(int pan, int speaker, int separation)
{
        int val;
        val = abs(pan - speaker);
        val = (val * 127) / separation;
        val = 127 - val;
        if (val < 0) return 0;
        if (val > 127) return 127;
        return val;
}

Greg


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Jun 16 2004 - 03:26:12 EEST