Creates a double-precision Hann window.
SDKs
- iOS 4.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Accelerate
Declaration
func vDSP_hann_windowD(_ __C: Unsafe Mutable Pointer<Double>, _ __N: v DSP _Length, _ __Flag: Int32)
Parameters
__C
Double-precision real output vector.
__N
The desired window length.
__Flag
The
Flag
parameter can have the following values:v
creates a denormalized window.DSP _HANN _DENORM v
|DSP _HANN _DENORM v
creates a denormalized window with only the firstDSP _HALF _WINDOW (N+1)/2
points.v
creates a normalized window.DSP _HANN _NORM v
|DSP _HANN _NORM v
creates a normalized window with only the firstDSP _HALF _WINDOW (N+1)/2
points.
Discussion
The v
and v
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 v
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 = [Double](repeating: 0,
count: Int(n))
vDSP_hann_windowD(&c,
n,
Int32(vDSP_HANN_DENORM))
The following illustrates the values of the output vector, c
:
