espnet2.layers.augmentation.contrast
Less than 1 minute
espnet2.layers.augmentation.contrast
espnet2.layers.augmentation.contrast(waveform, sample_rate: int = 16000, enhancement_amount: float = 75.0)
Apply contrast effect to the input signal to make it sound louder.
This function applies a contrast enhancement effect to the given audio waveform. The enhancement amount controls the degree of contrast applied, making the signal sound louder. The enhancement_amount parameter allows values from 0 to 100, with 0 still providing a noticeable effect.
- Parameters:
- waveform (torch.Tensor) – audio signal (…, time).
- sample_rate (int) – sampling rate in Hz (not used).
- enhancement_amount (float) – controls the amount of the enhancement. Allowed range of values for enhancement_amount: 0-100. Note that enhancement_amount = 0 still gives a significant contrast enhancement.
- Returns: filtered signal (…, time).
- Return type: ret (torch.Tensor)
Examples
>>> import torch
>>> waveform = torch.randn(1, 16000) # Example waveform
>>> enhanced_waveform = contrast(waveform, 16000, 75.0)