librosa.filters.wavelet_lengths(*, freqs, sr=22050, window='hann', filter_scale=1, gamma=0, alpha=None)[source]

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 freqs[k+1] and freqs[k-1]:

alpha[k] = (freqs[k+1]-freqs[k-1]) / (freqs[k+1]+freqs[k-1])

If freqs follows a geometric progression (as in CQT and VQT), the vector alpha is constant and such that:

(1 + alpha) * freqs[k-1] = (1 - alpha) * freqs[k+1]

Furthermore, if gamma=0 (default), alpha is such that even-k and odd-k filters are interleaved:

freqs[k-1] + B[k-1] = freqs[k+1] - B[k+1]

If gamma=None is specified, then gamma is computed such that each filter has bandwidth proportional to the equivalent rectangular bandwidth (ERB) at frequency freqs[k]:

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 alpha parameter 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.

  • If filter_scale is not strictly positive

  • If gamma is a negative number

  • If any frequencies are <= 0

  • If the frequency array is not sorted in ascending order


This function caches at level 10.