Skip to content

Gain

Added in v0.11.0

Multiply the audio by a random amplitude factor to reduce or increase the volume. This technique can help a model become somewhat invariant to the overall gain of the input audio.

Warning: This transform can return samples outside the [-1, 1] range, which may lead to clipping or wrap distortion, depending on what you do with the audio in a later stage. See also https://en.wikipedia.org/wiki/Clipping_(audio)#Digital_clipping

Gain API

min_gain_in_db: float • unit: Decibel
⚠ Deprecated as of v0.31.0. Use min_gain_db instead
max_gain_in_db: float • unit: Decibel
⚠ Deprecated as of v0.31.0. Use max_gain_db instead
min_gain_db: float • unit: Decibel
Default: -12.0. Minimum gain.
max_gain_db: float • unit: Decibel
Default: 12.0. Maximum gain.
p: float • range: [0.0, 1.0]
Default: 0.5. The probability of applying this transform.