hann(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
>>> import lucid
>>> from lucid.signal.windows import hann
>>> w = hann(5) # the endpoints are zero up to float32 round-off
>>> lucid.allclose(w, lucid.tensor([0.0, 0.5, 1.0, 0.5, 0.0]), atol=1e-6)
TrueUsed by 1
- lucid._ops.composite.spectral