fn
hann
→Tensorhann(M: int, sym: bool = True, dtype: DTypeLike = None, device: DeviceLike = None)Hann (raised-cosine) window.
The Hann window is a single full cycle of a raised cosine. Its side-lobes roll off at , the fastest asymptotic decay among the simple cosine-sum windows, which makes it a popular default for STFT analysis when temporal localisation matters more than peak side-lobe suppression.
Parameters
MintNumber of samples in the output window; must be
>= 0.symbool= TrueSymmetric (
True, default) or periodic (False) variant.dtypeDTypeLike= NoneDesired dtype of the output tensor.
deviceDeviceLike= NoneTarget device for the output tensor.
Returns
Tensor1-D tensor of length M containing the window samples.
Notes
Sample formula (special case of general_hamming with
):
Main-lobe width , peak side-lobe attenuation . Vanishes at both endpoints.
Examples
>>> from lucid.signal.windows import hann
>>> hann(5)
Tensor([0.0000, 0.5000, 1.0000, 0.5000, 0.0000])