MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / cepstral_lifter

Function cepstral_lifter

numpy_ml/preprocessing/dsp.py:489–520  ·  view source on GitHub ↗

A simple sinusoidal filter applied in the Mel-frequency domain. Notes ----- Cepstral lifting helps to smooth the spectral envelope and dampen the magnitude of the higher MFCC coefficients while keeping the other coefficients unchanged. The filter function is: .. math::

(mfccs, D)

Source from the content-addressed store, hash-verified

487
488
489def cepstral_lifter(mfccs, D):
490 """
491 A simple sinusoidal filter applied in the Mel-frequency domain.
492
493 Notes
494 -----
495 Cepstral lifting helps to smooth the spectral envelope and dampen the
496 magnitude of the higher MFCC coefficients while keeping the other
497 coefficients unchanged. The filter function is:
498
499 .. math::
500
501 \\text{lifter}( x_n ) = x_n \left(1 + \\frac{D \sin(\pi n / D)}{2}\\right)
502
503 Parameters
504 ----------
505 mfccs : :py:class:`ndarray <numpy.ndarray>` of shape `(G, C)`
506 Matrix of Mel cepstral coefficients. Rows correspond to frames, columns
507 to cepstral coefficients
508 D : int in :math:`[0, +\infty]`
509 The filter coefficient. 0 corresponds to no filtering, larger values
510 correspond to greater amounts of smoothing
511
512 Returns
513 -------
514 out : :py:class:`ndarray <numpy.ndarray>` of shape `(G, C)`
515 The lifter&#x27;d MFCC coefficients
516 """
517 if D == 0:
518 return mfccs
519 n = np.arange(mfccs.shape[1])
520 return mfccs * (1 + (D / 2) * np.sin(np.pi * n / D))
521
522
523def mel_spectrogram(

Callers 1

mfccFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected