espnet2.layers.augmentation.clipping
Less than 1 minute
espnet2.layers.augmentation.clipping
espnet2.layers.augmentation.clipping(waveform, sample_rate: int, min_quantile: float = 0.0, max_quantile: float = 0.9)
Apply the clipping distortion to the input signal.
This function clips the waveform to the specified quantile limits. The clipping is performed based on the provided minimum and maximum quantiles, which determine the lower and upper bounds of the signal values that will be retained. Any values outside these bounds will be clipped.
- Parameters:
- waveform (torch.Tensor) – audio signal (…, time)
- sample_rate (int) – sampling rate in Hz (not used)
- min_quantile (float) – lower bound on the total percent of samples to be clipped
- max_quantile (float) – upper bound on the total percent of samples to be clipped
- Returns: clipped signal (…, time)
- Return type: ret (torch.Tensor)
Examples
>>> waveform = torch.tensor([0.1, 0.5, 0.9, 1.0, 1.5, 2.0])
>>> clipped_waveform = clipping(waveform, sample_rate=16000,
... min_quantile=0.0, max_quantile=0.9)
>>> print(clipped_waveform)
tensor([0.1, 0.5, 0.9, 0.9, 0.9, 0.9])