# Windows - window functions

DSP.Windows.rectFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘│
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
│                                                                      │
0 │                                                                      │
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

rect(dims; padding=0, zerophase=false)

Rectangular window of length n, padded with padding zeros. This window is 1 within the window, and 0 outside of it.

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.hanningFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                             ▗▄▞▀▀▀▀▀▀▀▄▄                             │
│                           ▄▞▘           ▀▄▖                          │
│                         ▄▀                ▝▚▖                        │
│                       ▗▞                    ▝▄                       │
│                      ▞▘                      ▝▚▖                     │
│                    ▗▀                          ▝▚                    │
│                   ▞▘                             ▀▖                  │
│                 ▗▞                                ▝▄                 │
│                ▄▘                                   ▚▖               │
│              ▗▞                                      ▝▄              │
│             ▄▘                                         ▚▖            │
│           ▗▀                                            ▝▚           │
│         ▗▞▘                                               ▀▄         │
│       ▄▀▘                                                   ▀▚▖      │
0 │ ▄▄▄▄▀▀                                                        ▝▀▚▄▄▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

hanning(dims; padding=0, zerophase=false)

Hanning window of length n with padding zeros. The Hanning (or Hann) window is a raised-cosine window that reaches zero at the endpoints.

The window is defined by sampling the continuous function:

       1 + cos(2πx)
w(x) = ──────────── = cos²(πx)
2

in the range [-0.5, 0.5]

The hanning window satisfies the Constant Overlap-Add (COLA) property with an hop of 0.5, which means that adding together a sequence of delayed windows with 50% overlap will result in a constant signal. This is useful when synthesizing a signal from a number of overlapping frames (each with a roughly rectangular window), to eliminate windowing amplitude modulation.

Note that the hanning window is the cosine window squared.

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.hammingFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                             ▗▄▀▀▀▀▀▀▀▀▚▄                             │
│                           ▄▀▘           ▀▚▖                          │
│                         ▞▀                ▝▀▖                        │
│                       ▄▀                    ▝▚                       │
│                     ▗▀                        ▀▚                     │
│                   ▗▞▘                           ▀▄                   │
│                  ▄▘                               ▚▖                 │
│                ▗▞                                  ▝▄                │
│               ▞▘                                     ▀▖              │
│             ▄▀                                        ▝▚▖            │
│           ▗▞                                            ▝▄           │
│         ▄▞▘                                               ▀▄▖        │
│      ▗▄▀                                                    ▝▚▄      │
│ ▄▄▄▞▀▘                                                         ▀▀▄▄▄▖│
0 │                                                                      │
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

hamming(dims; padding=0, zerophase=false)

Hamming window of length n with padding zeros. The Hamming window does not reach zero at the endpoints and so has a shallower frequency roll-off when compared to the Hanning window, but is designed to cancel the first side-lobe.

The window is defined by sampling the continuous function:

w(x) = 0.54 + 0.46*cos(2pi*x)

in the range [-0.5, 0.5]

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.tukeyFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │            ▗▞▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄            │
│           ▞▘                                             ▌           │
│          ▗▘                                              ▝▌          │
│         ▗▌                                                ▝▖         │
│         ▞                                                  ▚         │
│        ▗▘                                                  ▝▌        │
│        ▞                                                    ▐        │
│       ▐▘                                                     ▌       │
│       ▌                                                      ▐▖      │
│      ▐                                                        ▚      │
│      ▌                                                        ▝▖     │
│     ▞                                                          ▚     │
│    ▞▘                                                           ▌    │
│   ▗▘                                                            ▝▚   │
0 │ ▄▄▘                                                               ▚▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

tukey(dims, α; padding=0, zerophase=false)

Tukey window of length n with padding zeros. The Tukey window has a flat top and reaches zero at the endpoints, with a sinusoidal transition area parameterized by α. For α == 0, the window is equivalent to a rectangular window. For α == 1, the window is a Hann window.

The window is defined by sampling the continuous function:

       ⎛              ⎛    ⎛    1 - α⎞⎞
⎜      1 + cos ⎜2πα ⎜x + ─────⎟⎟             1 - α
⎜              ⎝    ⎝      2  ⎠⎠         x ≤ ─────
⎜      ─────────────────────────               2
⎜                  2
⎜
w(x) = ⎜      1                                 -α/2 < x ≤ α/2
⎜
⎜              ⎛    ⎛    1 - α⎞⎞
⎜      1 + cos ⎜2πα ⎜x - ─────⎟⎟             1 - α
⎜              ⎝    ⎝      2  ⎠⎠         x > ─────
⎜      ─────────────────────────               2
⎝                  2

in the range [-0.5, 0.5]

Providing a dims Tuple rather than a single n constructs a 2D window. α, padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.cosineFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                           ▗▄▞▀▀▀▀▀▀▀▀▀▀▀▄▄                           │
│                        ▄▞▀▘               ▀▀▄▖                       │
│                     ▗▞▀                      ▝▚▄                     │
│                   ▄▀▘                           ▀▚▖                  │
│                 ▄▀                                ▝▚▖                │
│               ▄▀                                    ▝▚▖              │
│             ▗▞                                        ▝▄             │
│            ▞▘                                           ▀▖           │
│          ▄▀                                              ▝▚▖         │
│        ▗▞                                                  ▝▄        │
│       ▄▘                                                     ▚▖      │
│     ▗▞                                                        ▝▄     │
│    ▄▘                                                           ▚▖   │
│  ▗▞                                                              ▝▄  │
0 │ ▄▘                                                                 ▚▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

cosine(dims; padding=0, zerophase=false)

Cosine window of length n with padding zeros. The cosine window is the first lobe of a cosine function (with the zero crossings at +/- π as endpoints). Also called the sine window.

The window is defined by sampling the continuous function:

w(x) = cos(πx)

in the range [-0.5, 0.5]

Note that the cosine window is the square root of the hanning window, so it is sometimes used when you are applying the window twice, such as the analysis and synthesis steps of an STFT.

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.lanczosFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                            ▗▄▞▀▀▀▀▀▀▀▀▀▄▄                            │
│                         ▗▞▀▘             ▀▀▄                         │
│                       ▄▀▘                   ▀▚                       │
│                     ▄▀                        ▀▚▖                    │
│                   ▄▀                            ▝▚▖                  │
│                 ▗▀                                ▝▚                 │
│               ▗▞▘                                   ▀▄               │
│              ▞▘                                       ▀▖             │
│            ▄▀                                          ▝▚▖           │
│          ▗▞                                              ▝▄          │
│         ▞▘                                                 ▀▖        │
│       ▄▀                                                    ▝▚▖      │
│     ▗▞                                                        ▝▄     │
│   ▗▞▘                                                           ▀▄   │
0 │ ▄▞▘                                                               ▀▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

lanczos(dims; padding=0, zerophase=false)

Lanczos window of length n with padding zeros. The Lanczos window is the main lobe of a sinc function.

The window is defined by sampling the continuous function:

                  sin(2πx)
w(x) = sinc(2x) = ────────
2πx

in the range [-0.5, 0.5]

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.triangFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                                ▄▞▀▀▀▄▖                               │
│                            ▗▄▞▀      ▝▀▄▖                            │
│                         ▗▄▀▘            ▝▀▄▖                         │
│                      ▗▄▀▘                  ▝▀▄▖                      │
│                   ▗▄▀▘                        ▝▀▄▖                   │
│                ▗▄▀▘                              ▝▀▄▄                │
│             ▗▄▀▘                                     ▀▚▄             │
│          ▗▄▀▘                                           ▀▙▄          │
│       ▄▄▀▘                                                 ▀▚▄       │
│    ▄▞▀                                                        ▀▚▄    │
│ ▄▞▀                                                              ▀▚▄ │
│▀                                                                    ▀│
│                                                                      │
│                                                                      │
0 │                                                                      │
└──────────────────────────────────────────────────────────────────────┘
1                                                                      7

triang(dims; padding=0, zerophase=false)

Triangular window of length n with padding zeros. The Triangular window does not reach zero at the endpoints. For odd n the triang window is the center n points of an n+2-point bartlett window (i.e. the samples just outside the window would be zero). For even n the window slope is the same as the n-1 window but delayed by a half sample so the zero points would be 1/2 sample past the ends of the window.

The window is defined by sampling the continuous function:

        ⎛    2(n-1)
⎜1 - ────── abs(x)     n is even
⎜       n
w(x) =  ⎜
⎜    2(n-1)
⎜1 - ────── abs(x)     n is odd
⎝     n+1

in the range [-0.5, 0.5].

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

When zerophase is true substitute n+1 for n in the above window expressions.

source
DSP.Windows.bartlettFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                                 ▄▀▀▚▖                                │
│                              ▗▄▀    ▝▚▄                              │
│                            ▗▞▘         ▀▄                            │
│                          ▄▞▘             ▀▄▖                         │
│                        ▄▀                  ▝▚▖                       │
│                     ▗▄▀                      ▝▄▄                     │
│                   ▗▞▘                           ▀▄                   │
│                 ▄▞▘                               ▀▄▖                │
│               ▄▀                                    ▝▚▖              │
│            ▗▞▀                                        ▝▀▄            │
│          ▗▞▘                                             ▀▄          │
│        ▄▀▘                                                 ▀▚▖       │
│      ▄▀                                                      ▝▚▖     │
│   ▗▞▀                                                          ▝▀▄   │
0 │ ▄▞▘                                                               ▀▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

bartlett(dims; padding=0, zerophase=false)

Bartlett window of length n. The Bartlett window is a triangular window that reaches 0 at the endpoints. This is equivalent to convolving two rectangular windows of length (n-1)/2 and adding the zero endpoints. See triang for a window that does not reach zero at the endpoints.

The window is defined by sampling the continuous function:

1 - abs(2x)

in the range [-0.5, 0.5]

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.gaussianFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                              ▄▞▀▀▀▀▀▀▀▄▖                             │
│                            ▄▀          ▝▚▖                           │
│                          ▄▀              ▝▚▖                         │
│                        ▗▞                  ▝▄                        │
│                       ▄▘                     ▚                       │
│                     ▗▞                        ▚▄                     │
│                    ▄▘                           ▚▖                   │
│                  ▗▀                              ▝▚                  │
│                 ▞▘                                 ▀▖                │
│               ▄▀                                    ▝▚▖              │
│             ▄▀                                        ▝▚▖            │
│           ▄▀                                            ▝▚▖          │
│        ▄▞▀                                                ▝▀▄▖       │
│   ▗▄▄▀▀                                                      ▝▀▚▄▄   │
0 │ ▀▀▘                                                               ▀▀▘│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

gaussian(dims, σ; padding=0, zerophase=false)

Gives an n-sample gaussian window defined by sampling the function:

        ⎛        2⎞
⎜-1   ⎛x⎞ ⎟
⎜── ⋅ ⎜─⎟ ⎟
⎝ 2   ⎝σ⎠ ⎠
w(x) = e

in the range [-0.5,0.5]. This means that for σ=0.5 the endpoints of the window will correspond to 1 standard deviation away from the center.

Providing a dims Tuple rather than a single n constructs a 2D window. σ, padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.bartlett_hannFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                              ▗▄▞▀▀▀▀▀▄▄                              │
│                            ▄▀▘         ▀▚▖                           │
│                          ▄▀              ▝▚▖                         │
│                        ▄▀                  ▝▚▖                       │
│                      ▗▀                      ▝▖                      │
│                    ▗▞▘                        ▝▀▄                    │
│                   ▄▘                             ▚▖                  │
│                 ▗▞                                ▝▄                 │
│                ▞▘                                   ▀▖               │
│              ▄▀                                      ▝▚▖             │
│            ▗▞                                          ▝▄            │
│          ▗▞▘                                             ▀▄          │
│        ▗▞▘                                                 ▀▄        │
│      ▄▞▘                                                     ▀▄▖     │
0 │ ▄▄▄▀▀                                                          ▝▀▚▄▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

bartlett_hann(dims; padding=0, zerophase=false)

Bartlett-Hann window of length n with padding zeros. The Bartlett-Hann window is a weighted sum of the Bartlett and Hann windows.

The window is defined by sampling the continuous function:

w(x) = 0.62 - 0.48*abs(x) + 0.38*cos(2π*x)

in the range [-0.5, 0.5]

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.blackmanFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                               ▄▀▀▀▀▀▀▚▖                              │
│                             ▄▀        ▝▚▖                            │
│                           ▗▀            ▝▚                           │
│                          ▞▘               ▀▖                         │
│                        ▗▞                  ▝▄                        │
│                       ▗▘                     ▚                       │
│                      ▞▘                      ▝▚▖                     │
│                     ▞                          ▝▖                    │
│                   ▗▀                            ▝▚                   │
│                  ▄▘                               ▚▖                 │
│                ▗▞                                  ▝▄                │
│               ▞▘                                     ▀▖              │
│            ▗▄▀                                        ▝▚▄            │
│         ▗▄▞▘                                             ▀▄▄         │
0 │ ▄▄▄▄▄▄▞▀▘                                                   ▀▀▄▄▄▄▄▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

blackman(dims; padding=0, zerophase=false)

Approximates the "Exact" Blackman window. This is the generalized Blackman window with α = 0.16.

The window is defined by sampling the continuous function:

w(x) = 0.42 + 0.5*cos(2π*x) + 0.08*cos(4π*x)

in the range [-0.5, 0.5]

Providing a dims Tuple rather than a single n constructs a 2D window. padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.kaiserFunction
  ┌──────────────────────────────────────────────────────────────────────┐
1 │                               ▄▞▀▀▀▀▀▄▖                              │
│                             ▄▀        ▝▚▖                            │
│                           ▗▞            ▝▄                           │
│                          ▗▘               ▚                          │
│                         ▞▘                 ▀▖                        │
│                        ▞                    ▝▖                       │
│                      ▗▞                      ▐▖                      │
│                     ▗▘                        ▝▚                     │
│                    ▄▘                           ▚▖                   │
│                   ▞                              ▝▖                  │
│                 ▗▀                                ▝▚                 │
│               ▗▞▘                                   ▀▄               │
│             ▗▞▘                                       ▀▄             │
│          ▗▄▞▘                                           ▀▄▄          │
0 │ ▄▄▄▄▄▄▄▞▀▘                                                 ▀▀▄▄▄▄▄▄▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

kaiser(dims, α; padding=0, zerophase=false)

Kaiser window of length n parameterized by α. The Kaiser window approximates the DPSS window (given by dpss), using a simplified definition relying on a Bessel function. Larger values for α give a wider main lobe but have lower sidelobes. Typically α is set around 3.

The window is defined by sampling the continuous function:

         ⎛  ⎛   _________⎞⎞
⎜  ⎜  ╱        2⎟⎟
w(x) = I₀⎝πα⎝╲╱ 1 - (2x) ⎠⎠
────────────────────
I₀(πα)

in the range [-0.5, 0.5]

Where I₀(⋅) is the zeroth-order modified Bessel function of the first kind.

Providing a dims Tuple rather than a single n constructs a 2D window. α, padding and zerophase can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source
DSP.Windows.dpssFunction
    ┌──────────────────────────────────────────────────────────────────────┐
0.2 │                              ▄▄▀▀▀▀▀▀▚▄▖                             │
│                           ▗▞▀          ▝▀▄                           │
│                         ▗▞▘               ▀▄                         │
│                        ▄▘                   ▚▖                       │
│                      ▗▀                      ▝▖                      │
│                     ▞▘                        ▝▀▖                    │
│                   ▄▀                            ▝▚▖                  │
│                 ▗▞                                ▝▄                 │
│                ▄▘                                   ▚▖               │
│              ▗▞                                      ▝▄              │
│            ▗▞▘                                         ▀▄            │
│          ▗▞▘                                             ▀▄          │
│        ▄▞▘                                                 ▀▄▖       │
│     ▄▞▀                                                      ▝▀▄▖    │
0 │ ▄▞▀▀                                                            ▝▀▀▄▖│
└──────────────────────────────────────────────────────────────────────┘
0                                                                     70

dpss(n::Integer, nw::Real, ntapers::Integer=iceil(2*nw)-1;
padding::Integer=0, zerophase::Bool=false)

The first ntapers discrete prolate spheroid sequences (Slepian tapers) as an n × ntapers matrix. The signs of the tapers follow the convention that the first element of the skew-symmetric (odd) tapers is positive. The time-bandwidth product is given by nw.

The DPSS window maximizes the energy concentration in the main lobe.

If zerophase is false (the default) the window is centered around index (n+1)/2, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.

If zerophase is true the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1-length non-zerophase window. Alternatively you can think of the continuous zerophase window being of width n and the non-zerophase window being of length n-1. zerophase windows are often used in FFT processing, and are usually even-length.

source