librosa.core.icqt

librosa.core.icqt(C, sr=22050, hop_length=512, fmin=None, bins_per_octave=12, tuning=0.0, filter_scale=1, norm=1, sparsity=0.01, window=’hann’, scale=True, amin=1e-06)[source]

Compute the inverse constant-Q transform.

Given a constant-Q transform representation C of an audio signal y, this function produces an approximation y_hat.

Warning

This implementation is unstable, and subject to change in future versions of librosa. We recommend that its use be limited to sonification and diagnostic applications.

Parameters:
C : np.ndarray, [shape=(n_bins, n_frames)]

Constant-Q representation as produced by core.cqt

hop_length : int > 0 [scalar]

number of samples between successive frames

fmin : float > 0 [scalar]

Minimum frequency. Defaults to C1 ~= 32.70 Hz

tuning : float in [-0.5, 0.5) [scalar]

Tuning offset in fractions of a bin (cents).

filter_scale : float > 0 [scalar]

Filter scale factor. Small values (<1) use shorter windows for improved time resolution.

norm : {inf, -inf, 0, float > 0}

Type of norm to use for basis function normalization. See librosa.util.normalize.

sparsity : float in [0, 1)

Sparsify the CQT basis by discarding up to sparsity fraction of the energy in each basis.

Set sparsity=0 to disable sparsification.

window : str, tuple, number, or function

Window specification for the basis filters. See filters.get_window for details.

scale : bool

If True, scale the CQT response by square-root the length of each channel’s filter. This is analogous to norm=’ortho’ in FFT.

If False, do not scale the CQT. This is analogous to norm=None in FFT.

amin : float or None

When applying squared window normalization, sample positions with coefficients below amin will left as is.

If None, then amin is inferred as the smallest valid floating point value.

Returns:
y : np.ndarray, [shape=(n_samples), dtype=np.float]

Audio time-series reconstructed from the CQT representation.

See also

cqt

Notes

This function caches at level 40.

Examples

Using default parameters

>>> y, sr = librosa.load(librosa.util.example_audio_file(), duration=15)
>>> C = librosa.cqt(y=y, sr=sr)
>>> y_hat = librosa.icqt(C=C, sr=sr)

Or with a different hop length and frequency resolution:

>>> hop_length = 256
>>> bins_per_octave = 12 * 3
>>> C = librosa.cqt(y=y, sr=sr, hop_length=256, n_bins=7*bins_per_octave,
...                 bins_per_octave=bins_per_octave)
>>> y_hat = librosa.icqt(C=C, sr=sr, hop_length=hop_length,
...                 bins_per_octave=bins_per_octave)