-2

can anyone please explain me or give some source for "how to properly apply 32 window function on a PCM signal ? I need this to perform fft on audio signal , but couldnt find out a proper way of doing it !

1 Answers1

0

To apply a N = 32 window function on a signal you will need to have a PCM signal of length 32 (this means you need to either crop your signal if its too long or divide it into chunks), you then apply the window function by just multiplying the window with the signal.

For more on Windows see : http://en.wikipedia.org/wiki/Window_function

The following is indicative code of how you would implement a Hann N = 32 window in C#.

float Hann ( int n )
{
  int N = 32;
  float result = 0.5 * ( 1 - Math.Cos( 2 * PI * n / (N - 1) );
  return result;
}

Then to apply the window you would just multiply the window with your data.

myData = new float[32];
myWindowedData = new float[32];    
myData = getData();

for( int i = 0 ; i < 32; i++)
   myWindowedData = myData[i]*Hann(i);

Hope I have made things a bit clearer.

KillaKem
  • 995
  • 1
  • 13
  • 29