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
Input-output example
Here we input a speech recording and apply a -8 dB gain.

| Input sound | Transformed sound |
|---|---|
Gain API
min_gain_in_db:float• unit: DecibelDeprecated as of v0.31.0, removed as of v0.38.0. Use
min_gain_dbinsteadmax_gain_in_db:float• unit: DecibelDeprecated as of v0.31.0, removed as of v0.38.0. Use
max_gain_dbinsteadmin_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.