Function

vDSP_hamm_windowD(_:_:_:)

Creates a double-precision Hamming window.

Declaration

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

Parameters

C

Double-precision real output vector.

N

The desired window length.

__Flag

Pass the vDSP_HALF_WINDOW flag to create only the first (n+1)/2 points, or zero for a full-size window.

Discussion

The vDSP_hamm_window(_:_:_:) and vDSP_hamm_windowD(_:_:_:) functions create a Hamming window vector, and write the result to C, which can be multiplied by a vector using vDSP_vmul.

for (n=0; n < N; ++n)
{
    C[n] = 0.54 - (0.46 * cos( 2 * pi * n / N ) );
}

The following code shows how to generate a Hamming window:

let n = vDSP_Length(1024)

var c = [Float](repeating: 0,
                count: Int(n))

vDSP_hamm_window(&c,
                 n,
                 0)

The following illustrates the values of the output vector, c:

Visualization of Hamming 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.