fn

blackman

Tensor
blackman(M: int, sym: bool = True, dtype: DTypeLike = None, device: DeviceLike = None)
source

Blackman window.

Three-term cosine-sum window designed by Blackman and Tukey to drive the first three side-lobes substantially below the Hann level. Peak side-lobe attenuation is 58dB\approx -58\, \text{dB} with a main-lobe roughly twice as wide as the Hann window.

Parameters

Mint
Number of samples in the output window; must be >= 0.
symbool= True
Symmetric (True, default) or periodic (False) variant.
dtypeDTypeLike= None
Desired dtype of the output tensor.
deviceDeviceLike= None
Target device for the output tensor.

Returns

Tensor

1-D tensor of length M.

Notes

Sample formula (special case of general_cosine with coefficients [0.42, 0.50, 0.08]):

w[n]=0.420.50cos ⁣(2πnN1)+0.08cos ⁣(4πnN1),0n<N.w[n] = 0.42 - 0.50 \cos\!\left(\frac{2\pi n}{N - 1}\right) + 0.08 \cos\!\left(\frac{4\pi n}{N - 1}\right), \qquad 0 \le n < N.

The slightly different "exact Blackman" uses coefficients derived from the first two zeros of the side-lobe envelope; the standard [0.42, 0.50, 0.08] truncation used here is the textbook form.

Examples

>>> from lucid.signal.windows import blackman
>>> blackman(5)
Tensor([0.0000, 0.3400, 1.0000, 0.3400, 0.0000])