librosa.feature.inverse.logfrequency_to_audio#
- librosa.feature.inverse.logfrequency_to_audio(L, *, sr=22050, n_fft=2048, hop_length=None, win_length=None, window='hann', center=True, pad_mode='constant', power=2.0, n_iter=32, length=None, dtype=<class 'numpy.float32'>, rng=None, n_bins=None, bins_per_octave=12, fmin=None, tuning=0.0, filter_window='triangle', norm='slaney', **kwargs)[source]#
Invert a logarithmic frequency spectrogram to audio using Griffin-Lim.
This is primarily a convenience wrapper for:
>>> S = librosa.feature.inverse.logfrequency_to_stft(L) >>> y = librosa.griffinlim(S)
- Parameters:
- Lnp.ndarray [shape=(…, n_bins, t), non-negative]
The spectrogram as produced by feature.logfrequency_spectrogram
- srnumber > 0 [scalar]
Sampling rate of the underlying signal.
- n_fftint > 0 [scalar]
Length of the FFT frame for the intermediate STFT.
- hop_lengthNone or int > 0
The hop length of the STFT. If not provided, it will default to
n_fft // 4.- win_lengthNone or int > 0
The window length of the STFT. By default, it will equal
n_fft.- windowstr, tuple, number, function, or np.ndarray [shape=(n_fft,)]
A window specification as supported by stft or istft.
- centerbool
If True, the STFT is assumed to use centered frames. If False, the STFT is assumed to use left-aligned frames.
- pad_modestr
If
center=True, the padding mode to use at the edges of the signal. By default, STFT uses zero padding.- powerfloat > 0 [scalar]
Exponent for the magnitude spectrogram.
- n_iterint > 0
The number of iterations for Griffin-Lim.
- lengthNone or int > 0
If provided, the output
yis zero-padded or clipped to exactlylengthsamples.- dtypenp.dtype
Real numeric type for the time-domain signal. Default is 32-bit float.
- rngNone, int, sequence of int, np.random.Generator, or np.random.RandomState
Random number generator or seed for phase initialization in
librosa.griffinlim. Pass an integer seed for reproducible reconstruction.- n_binsint > 0 [scalar, optional]
Number of logarithmic frequency bands. If None, defaults to
L.shape[-2].- bins_per_octaveint > 0 [scalar], default=12
Number of filter bands per octave.
- fminfloat > 0, str, or None, optional
Lowest frequency (in Hz) or note name in SPN format (e.g. ‘C1’). Defaults to note_to_hz(‘C1’) (~32.7 Hz).
- tuningfloat, default=0.0
Tuning deviation from A440 in fractional bins.
- filter_windowstr or callable, default=’triangle’
Filter shape for the log-frequency basis.
- norm{None, ‘slaney’, or number}, default=’slaney’
Normalization applied to each filter row.
- **kwargsadditional keyword arguments
Additional keyword arguments for
librosa.filters.logfrequency.
- Returns:
- ynp.ndarray [shape=(…, n)]
Time-domain signal reconstructed from
L.