vDSP_hann_window
Creates a single-precision Hann window.
Declaration
extern void vDSP_hann_window(float *__C, vDSP_Length __N, int __Flag);Parameters
- __C:
The output vector.
- __N:
The number of elements in the output vector.
- __Flag:
A value that specifies the type of window that the function creates.
Vdsp_hann_denorm specifies that the function creates a denormalized window.
Vdsp_hann_denorm | Vdsp_half_window specifies that the function creates a denormalized window with only the first
(N+1)/2points.Vdsp_hann_norm specifies that the function creates a normalized window.
Vdsp_hann_norm | Vdsp_half_window specifies that the function creates a normalized window with only the first
(N+1)/2points.
Discussion
The vDSP_hann_window and vDSP_hann_windowD functions create a Hann window vector using the following operation:
If Flag & vDSP_HALF_WINDOW:
Length = (N+1)/2;
Else
Length = N;
If Flag & vDSP_HANN_NORM:
W = .8165;
Else
W = .5;
for (n = 0; n < Length; ++n)
C[n] = W * (1 - cos(2*pi*n/N));Use vDSP_vmul to multiply the Hann window result by a noninteger-periodic signal prior to a Fourier transform.
The following code shows how to generate a Hann window:
let n = vDSP_Length(1024)
var c = [Float](repeating: 0,
count: Int(n))
vDSP_hann_window(&c,
n,
Int32(vDSP_HANN_DENORM))The following illustrates the values of the output vector, c:
[Image]