espnet2.layers.augmentation.deemphasis
Less than 1 minute
espnet2.layers.augmentation.deemphasis
espnet2.layers.augmentation.deemphasis(waveform, sample_rate: int, coeff: float = 0.97)
De-emphasize a waveform along the time dimension.
This function applies a de-emphasis filter to the input waveform, which is typically used in speech processing to reduce the high-frequency content of the signal. The de-emphasis operation is defined as:
y[i] = x[i] + coeff * y[i - 1]
where x is the input waveform, y is the output waveform, and coeff is the de-emphasis coefficient.
- Parameters:
- waveform (torch.Tensor) – audio signal (…, time).
- sample_rate (int) – sampling rate in Hz (not used).
- coeff (float) – de-emphasis coefficient. Typically between 0.0 and 1.0.
- Returns: de-emphasized signal (…, time).
- Return type: ret (torch.Tensor)
Examples
>>> import torch
>>> waveform = torch.tensor([0.5, 0.3, 0.1, -0.1, -0.3])
>>> sample_rate = 16000
>>> coeff = 0.97
>>> de_emphasized_waveform = deemphasis(waveform, sample_rate, coeff)