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.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, length=None, amin=<DEPRECATED parameter>, res_type='fft', dtype=<class 'numpy.float32'>)[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.
- Parameters
- Cnp.ndarray, [shape=(n_bins, n_frames)]
Constant-Q representation as produced by core.cqt
- hop_lengthint > 0 [scalar]
number of samples between successive frames
- fminfloat > 0 [scalar]
Minimum frequency. Defaults to C1 ~= 32.70 Hz
- tuningfloat [scalar]
Tuning offset in fractions of a bin.
The minimum frequency of the CQT will be modified to fmin * 2**(tuning / bins_per_octave).
- filter_scalefloat > 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
.- sparsityfloat 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.
- windowstr, tuple, number, or function
Window specification for the basis filters. See filters.get_window for details.
- scalebool
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.
- lengthint > 0, optional
If provided, the output y is zero-padded or clipped to exactly length samples.
- aminfloat or None [DEPRECATED]
Note
This parameter is deprecated in 0.7.0 and will be removed in 0.8.0.
- res_typestring
Resampling mode. By default, this uses
fft
mode for high-quality reconstruction, but this may be slow depending on your signal duration. Seelibrosa.resample
for supported modes.- dtypenumeric type
Real numeric type for y. Default is 32-bit float.
- Returns
- ynp.ndarray, [shape=(n_samples), dtype=np.float]
Audio time-series reconstructed from the CQT representation.
See also
cqt
core.resample
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)