- librosa.filters.wavelet_lengths(*, freqs, sr=22050, window='hann', filter_scale=1, gamma=0, alpha=None)¶
Return length of each filter in a wavelet basis.
- freqsnp.ndarray (positive)
Center frequencies of the filters (in Hz). Must be in ascending order.
- srnumber > 0 [scalar]
Audio sampling rate
- windowstr or callable
Window function to use on filters
- filter_scalefloat > 0 [scalar]
Resolution of filter windows. Larger values use longer windows.
- gammanumber >= 0 [scalar, optional]
Bandwidth offset for determining filter lengths, as used in Variable-Q transforms.
Bandwidth for the k’th filter is determined by:
B[k] = alpha[k] * freqs[k] + gamma
alpha[k]is twice the relative difference between
alpha[k] = (freqs[k+1]-freqs[k-1]) / (freqs[k+1]+freqs[k-1])
freqsfollows a geometric progression (as in CQT and VQT), the vector
alphais constant and such that:
(1 + alpha) * freqs[k-1] = (1 - alpha) * freqs[k+1]
alphais such that even-
kfilters are interleaved:
freqs[k-1] + B[k-1] = freqs[k+1] - B[k+1]
gamma=Noneis specified, then
gammais computed such that each filter has bandwidth proportional to the equivalent rectangular bandwidth (ERB) at frequency
gamma[k] = 24.7 * alpha[k] / 0.108
as derived by 1.
Glasberg, Brian R., and Brian CJ Moore. “Derivation of auditory filter shapes from notched-noise data.” Hearing research 47.1-2 (1990): 103-138.
- alphanumber > 0 [optional]
If only one frequency is provided (
len(freqs)==1), then filter bandwidth cannot be computed. In that case, the
alphaparameter described above can be explicitly specified here.
If two or more frequencies are provided, this parameter is ignored.
The length of each filter.
The lowest frequency at which all filters’ main lobes have decayed by at least 3dB.
This second output serves in cqt and vqt to ensure that all wavelet bands remain below the Nyquist frequency.
filter_scaleis not strictly positive
gammais a negative number
If any frequencies are <= 0
If the frequency array is not sorted in ascending order
This function caches at level 10.