Caution
You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.11.0.
librosa.effects.deemphasis
- librosa.effects.deemphasis(y, *, coef=0.97, zi=None, return_zf=False)[source]
De-emphasize an audio signal with the inverse operation of preemphasis():
If y = preemphasis(x, coef=coef, zi=zi), the deemphasis is:
>>> x[i] = y[i] + coef * x[i-1] >>> x = deemphasis(y, coef=coef, zi=zi)
- Parameters:
- ynp.ndarray [shape=(…, n)]
Audio signal. Multi-channel is supported.
- coefpositive number
Pre-emphasis coefficient. Typical values of
coefare between 0 and 1.At the limit
coef=0, the signal is unchanged.At
coef=1, the result is the first-order difference of the signal.The default (0.97) matches the pre-emphasis filter used in the HTK implementation of MFCCs [1].
- zinumber
Initial filter state. If inverting a previous preemphasis(), the same value should be used.
By default
ziis initialized as((2 - coef) * y[0] - y[1]) / (3 - coef). This value corresponds to the transformation of the default initialization ofziinpreemphasis(),2*x[0] - x[1].- return_zfboolean
If
True, return the final filter state. IfFalse, only return the pre-emphasized signal.
- Returns:
- y_outnp.ndarray
de-emphasized signal
- zfnumber
if
return_zf=True, the final filter state is also returned
See also
Examples
Apply a standard pre-emphasis filter and invert it with de-emphasis
>>> y, sr = librosa.load(librosa.ex('trumpet')) >>> y_filt = librosa.effects.preemphasis(y) >>> y_deemph = librosa.effects.deemphasis(y_filt) >>> np.allclose(y, y_deemph) True