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

Function preemphasis

numpy_ml/preprocessing/dsp.py:458–486  ·  view source on GitHub ↗

Increase the amplitude of high frequency bands + decrease the amplitude of lower bands. Notes ----- Preemphasis filtering is (was?) a common transform in speech processing, where higher frequencies tend to be more useful during signal disambiguation. .. math::

(x, alpha)

Source from the content-addressed store, hash-verified

456
457
458def preemphasis(x, alpha):
459 """
460 Increase the amplitude of high frequency bands + decrease the amplitude of
461 lower bands.
462
463 Notes
464 -----
465 Preemphasis filtering is (was?) a common transform in speech processing,
466 where higher frequencies tend to be more useful during signal
467 disambiguation.
468
469 .. math::
470
471 \\text{preemphasis}( x_t ) = x_t - \\alpha x_{t-1}
472
473 Parameters
474 ----------
475 x : :py:class:`ndarray <numpy.ndarray>` of shape `(N,)`
476 A 1D signal consisting of `N` samples
477 alpha : float in [0, 1)
478 The preemphasis coefficient. A value of 0 corresponds to no
479 filtering
480
481 Returns
482 -------
483 out : :py:class:`ndarray <numpy.ndarray>` of shape `(N,)`
484 The filtered signal
485 """
486 return np.concatenate([x[:1], x[1:] - alpha * x[:-1]])
487
488
489def cepstral_lifter(mfccs, D):

Callers 1

mel_spectrogramFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected