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)
| 456 | |
| 457 | |
| 458 | def 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 | |
| 489 | def cepstral_lifter(mfccs, D): |