Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.9.1.

librosa.filters._multirate_fb

librosa.filters._multirate_fb(center_freqs=None, sample_rates=None, Q=25.0, passband_ripple=1, stopband_attenuation=50, ftype='ellip', flayout='sos')[source]

Helper function to construct a multirate filterbank.

A filter bank consists of multiple band-pass filters which divide the input signal into subbands. In the case of a multirate filter bank, the band-pass filters operate with resampled versions of the input signal, e.g. to keep the length of a filter constant while shifting its center frequency.

This implementation uses scipy.signal.iirdesign to design the filters.

Parameters
center_freqsnp.ndarray [shape=(n,), dtype=float]

Center frequencies of the filter kernels. Also defines the number of filters in the filterbank.

sample_ratesnp.ndarray [shape=(n,), dtype=float]

Samplerate for each filter (used for multirate filterbank).

Qfloat

Q factor (influences the filter bandwith).

passband_ripplefloat

The maximum loss in the passband (dB) See scipy.signal.iirdesign for details.

stopband_attenuationfloat

The minimum attenuation in the stopband (dB) See scipy.signal.iirdesign for details.

ftypestr

The type of IIR filter to design See scipy.signal.iirdesign for details.

flayoutstring

Valid output argument for scipy.signal.iirdesign.

  • If ba, returns numerators/denominators of the transfer functions, used for filtering with scipy.signal.filtfilt. Can be unstable for high-order filters.

  • If sos, returns a series of second-order filters, used for filtering with scipy.signal.sosfiltfilt. Minimizes numerical precision errors for high-order filters, but is slower.

  • If zpk, returns zeros, poles, and system gains of the transfer functions.

Returns
filterbanklist [shape=(n,), dtype=float]

Each list entry comprises the filter coefficients for a single filter.

sample_ratesnp.ndarray [shape=(n,), dtype=float]

Samplerate for each filter.

Raises
ParameterError

If center_freqs is None. If sample_rates is None. If center_freqs.shape does not match sample_rates.shape.

Notes

This function caches at level 10.