librosa.iirt(y, sr=22050, win_length=2048, hop_length=None, center=True, tuning=0.0, pad_mode='reflect', flayout='sos', **kwargs)[source]

Time-frequency representation using IIR filters

This function will return a time-frequency representation using a multirate filter bank consisting of IIR filters. 1

First, y is resampled as needed according to the provided sample_rates.

Then, a filterbank with with n band-pass filters is designed.

The resampled input signals are processed by the filterbank as a whole. (scipy.signal.filtfilt resp. sosfiltfilt is used to make the phase linear.) The output of the filterbank is cut into frames. For each band, the short-time mean-square power (STMSP) is calculated by summing win_length subsequent filtered time samples.

When called with the default set of parameters, it will generate the TF-representation (pitch filterbank):

  • 85 filters with MIDI pitches [24, 108] as center_freqs.

  • each filter having a bandwith of one semitone.


Müller, Meinard. “Information Retrieval for Music and Motion.” Springer Verlag. 2007.

ynp.ndarray [shape=(n,)]

audio time series

srnumber > 0 [scalar]

sampling rate of y

win_lengthint > 0, <= n_fft

Window length.

hop_lengthint > 0 [scalar]

Hop length, number samples between subsequent frames. If not supplied, defaults to win_length // 4.

  • If True, the signal y is padded so that frame D[:, t] is centered at y[t * hop_length].

  • If False, then D[:, t]` begins at y[t * hop_length]

tuningfloat [scalar]

Tuning deviation from A440 in fractions of a bin.


If center=True, the padding mode to use at the edges of the signal. By default, this function uses reflection padding.

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

  • If ba, the standard difference equation is used for filtering with scipy.signal.filtfilt. Can be unstable for high-order filters.

kwargsadditional keyword arguments

Additional arguments for librosa.filters.semitone_filterbank (e.g., could be used to provide another set of center_freqs and sample_rates).

bands_powernp.ndarray [shape=(n, t), dtype=dtype]

Short-time mean-square power for the input signal.


If flayout is not None, ba, or sos.


>>> import matplotlib.pyplot as plt
>>> y, sr = librosa.load(librosa.ex('trumpet'), duration=3)
>>> D = np.abs(librosa.iirt(y))
>>> C = np.abs(librosa.cqt(y=y, sr=sr))
>>> fig, ax = plt.subplots(nrows=2, sharex=True, sharey=True)
>>> img = librosa.display.specshow(librosa.amplitude_to_db(C, ref=np.max),
...                                y_axis='cqt_hz', x_axis='time', ax=ax[0])
>>> ax[0].set(title='Constant-Q transform')
>>> ax[0].label_outer()
>>> img = librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),
...                                y_axis='cqt_hz', x_axis='time', ax=ax[1])
>>> ax[1].set_title('Semitone spectrogram (iirt)')
>>> fig.colorbar(img, ax=ax, format="%+2.0f dB")