<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP_hann_windowD",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vDSP_hann_windowD"
  },
  "title" : "vDSP_hann_windowD"
}
-->

# vDSP_hann_windowD

Creates a double-precision Hann window.

```
extern void vDSP_hann_windowD(double *__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.

- <doc://com.apple.documentation/documentation/kernel/1645052-anonymous/vdsp_hann_denorm> specifies that the function creates a denormalized window.
- <doc://com.apple.documentation/documentation/kernel/1645052-anonymous/vdsp_hann_denorm> | <doc://com.apple.documentation/documentation/kernel/1645052-anonymous/vdsp_half_window> specifies that the function creates a denormalized window with only the first `(N+1)/2` points.
- <doc://com.apple.documentation/documentation/kernel/1645052-anonymous/vdsp_hann_norm> specifies that the function creates a normalized window.
- <doc://com.apple.documentation/documentation/kernel/1645052-anonymous/vdsp_hann_norm> | <doc://com.apple.documentation/documentation/kernel/1645052-anonymous/vdsp_half_window> specifies that the function creates a normalized window with only the first `(N+1)/2` points.

## Discussion

The [`vDSP_hann_window`](/documentation/Accelerate/vDSP_hann_window) and [`vDSP_hann_windowD`](/documentation/Accelerate/vDSP_hann_windowD) functions create a Hann window vector using the following operation:

```swift
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`](/documentation/Accelerate/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:

```swift
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 a Hann window.](images/com.apple.accelerate/media-3368167@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)