Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.1.

librosa.effects.deemphasis

librosa.effects.deemphasis(y, coef=0.95, zi=None)[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

Audio signal

coefpositive number

Pre-emphasis coefficient. Typical values of coef are 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 zi is initialized as ((2 - coef) * y[0] - y[1]) / (3 - coef). This value corresponds to the transformation of the default initialization of zi in preemphasis(), 2*x[0] - x[1].

Returns:
y_outnp.ndarray

de-emphasized signal

See also

preemphasis

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