cutcutcodec.core.filter.audio.resample.kaiser

cutcutcodec.core.filter.audio.resample.kaiser(band: Real, attenuation: Real) ndarray[source]

Design a kaiser window with some frequencial properties.

Parameters

bandfloat

Transition band, as a fraction of the sampling rate in ]0, 0.5[.

attenuationfloat

The attenuation in the stopband in dB.

Returns

windowtorch.Tensor

The 1d symetric odd window.

Examples

>>> import numpy as np
>>> from cutcutcodec.core.filter.audio.resample import kaiser
>>> np.round(kaiser(0.05, 80), 5)
array([0.00267, 0.00453, 0.00692, 0.00991, 0.01359, 0.01803, 0.02331,
       0.02951, 0.03671, 0.04499, 0.05443, 0.06508, 0.07702, 0.0903 ,
       0.10497, 0.12107, 0.13863, 0.15766, 0.17817, 0.20016, 0.22359,
       0.24845, 0.27467, 0.30219, 0.33093, 0.3608 , 0.39168, 0.42346,
       0.45599, 0.48912, 0.5227 , 0.55654, 0.59048, 0.62431, 0.65784,
       0.69088, 0.72321, 0.75464, 0.78496, 0.81398, 0.84149, 0.86731,
       0.89127, 0.91319, 0.93292, 0.95033, 0.96527, 0.97765, 0.98737,
       0.99437, 0.99859, 1.     , 0.99859, 0.99437, 0.98737, 0.97765,
       0.96527, 0.95033, 0.93292, 0.91319, 0.89127, 0.86731, 0.84149,
       0.81398, 0.78496, 0.75464, 0.72321, 0.69088, 0.65784, 0.62431,
       0.59048, 0.55654, 0.5227 , 0.48912, 0.45599, 0.42346, 0.39168,
       0.3608 , 0.33093, 0.30219, 0.27467, 0.24845, 0.22359, 0.20016,
       0.17817, 0.15766, 0.13863, 0.12107, 0.10497, 0.0903 , 0.07702,
       0.06508, 0.05443, 0.04499, 0.03671, 0.02951, 0.02331, 0.01803,
       0.01359, 0.00991, 0.00692, 0.00453, 0.00267])