
Hello,
I
work with
the library
NAudio
recently.
Here is
my modest
contribution : Hann Window & BlackmannHarris Window
/// <summary>
/// Applies a Hann Window
/// </summary>
/// <param name="n">Index into frame</param>
/// <param name="frameSize">Frame size (e.g. 1024)</param>
/// <returns>Multiplier for Hann window</returns>
public static double HannWindow(int n, int frameSize)
{
return 0.5 * (1  Math.Cos((2 * Math.PI * n) / (frameSize  1)));
}
/// <summary>
/// Applies a BlackmanHarris Window
/// </summary>
/// <param name="n">Index into frame</param>
/// <param name="frameSize">Frame size (e.g. 1024)</param>
/// <returns>Multiplier for BlackmannHarris window</returns>
public static double BlackmannHarrisWindow(int n, int frameSize)
{
return 0.35875  (0.48829 * Math.Cos((2 * Math.PI * n) / (frameSize  1))) + (0.14128 * Math.Cos((4 * Math.PI * n) / (frameSize  1)))  (0.01168 * Math.Cos((4 * Math.PI * n) / (frameSize  1)));
}
best regard, Manu



thanks, I'll get these added. I'd been meaning to add some more windowing functions. I am thinking that it might be best for applications to precalculate the multiplier for each n rather than calling the window function directly for every sample since Math.Cos
and Math.Sin are relatively slow performancewise.
Mark

