Function

vDSP_hann_windowD(_:_:_:)

Creates a double-precision Hann window.

Declaration

func vDSP_hann_windowD(_ __C: UnsafeMutablePointer<Double>, _ __N: vDSP_Length, _ __Flag: Int32)

Parameters

__C

Double-precision real output vector.

__N

The desired window length.

__Flag

The Flag parameter can have the following values:

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_vmulD(_:_:_:_:_:_:_:) 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:

Visualization of Hann window.

See Also

Vector Generation with Window Functions

Using Windowing with Discrete Fourier Transforms

Multiply signal data by window sequence values to reduce spectral leakage.

enum vDSP.WindowSequence

Constants specifying window sequence functions.