Reply by bobthebullet990 March 28, 20072007-03-28
Do I have to implement an LFO to control the delay time so it varies? I
thought that the Phaser did not require an LFO? Is this why there is no
audible phase shifting? 

_____________________________________
Do you know a company who employs DSP engineers?  
Is it already listed at http://dsprelated.com/employers.php ?
Reply by bobthebullet990 March 28, 20072007-03-28
Hi; I'm having a little trouble implementing the all-pass filter. I have
implemented an all-pass filter, when I run it on the DSK it seems work
fine; the output sound of the filter is the same as the input (but just a
little quieter). However, if I increase R (delay value) to more than 192
samples (=4ms with sample rate of 48khz), i get a really high pitch
ringing effect! Also, when the output of the allpass filter is mixed with
the original input, there is no phasing effect audible what so ever! I
have listed my filter code which I have designed using the description
written here:

http://www.harmony-central.com/Effects/Articles/Phase_Shifting/ 



Here's the allpass filter function:

/*************************************************************************/
/**                                                                    
**/
/** FUNCTION    : allPassFilter                                        
**/
/** DESCRIPTION : Function to apply an allpass filter to the input     
**/
/**               audio data.                                          
**/
/** REQUIRES    : addresss of current input L & R audio samples        
**/
/**               the number of samples used by the delay [R]          
**/
/**                                                                    
**/
/*************************************************************************/
void allPassFilter(short int * left, short int * right, int sampleDelay){
  
  float l_forward;            /* feedforward value for left channel     
*/
  float r_forward;            /* feedforward value for right channel    
*/
  static float l_back;        /* feedback value for left channel        
*/
  static float r_back;        /* feedback value for right channel       
*/
  static short int readPtr=0; /* stores position in buffer to read data 
*/
  static short int writePtr=0;/* stores position in buffer to write data
*/
  static int alpha = 0.8;     /* alpha value used for feedforward & back
*/
  
  /* calculate the feedforward values */
  l_forward = alpha * *left;
  r_forward = alpha * *right;
  
  /* Calculate position of the read & write pointers */
  if (writePtr < sampleDelay )
    readPtr = (((SAMPLE_RATE/1000)*MAX_DELAY) - (sampleDelay -
writePtr));
  else
    readPtr = writePtr - sampleDelay;
  
  if (++writePtr >= MAX_DELAY)
    writePtr = 0;  
  
  /* now add current audio sample to array */
  lBuffer[writePtr] = calculateAverage(*left,  (short int)l_back);
  rBuffer[writePtr] = calculateAverage(*right, (short int)r_back);
  
  /* calculate output values */
  *left  = calculateAverage(lBuffer[readPtr], (short int)l_forward);
  *right = calculateAverage(rBuffer[readPtr], (short int)r_forward);

  /* calculate the feedback values */
  l_back = (0-alpha) * *left;
  r_back = (0-alpha) * *right;  
  
}


And in my main method, here is the call to the filter

inputL = input value from mcbsp
intputR = input value from mcbsp

outL = inputL; /* to allow filter to edit the outL value using ptrs */
outR = outL;   /* to allow filter to edit the outR value using ptrs */

/* apply the allpassfilter - R=192 */
allPassFilter(&outL, &outR, 192);

/* mixEffect:          dry,    wet,  dry value, wet value */
mcbsp1_write(mixEffect(inputL, outL, 0.5,       0.6));
mcbsp1_write(mixEffect(inputR, outR, 0.5,       0.6));	  

/* write the current audio level to the audio meter */
audioMeter(calculateAverage(inputL, inputR));



Can anybody tell me where the constant high-pitch sound comes from when
the delay goes above approx 4ms??? And whether this is a correct
implementation of a 1st stage all pass filter, and if not, where to point
me to put me on the right lines! Thanks...

_____________________________________
Do you know a company who employs DSP engineers?  
Is it already listed at http://dsprelated.com/employers.php ?