TimeMask
Added in v0.7.0
Make a randomly chosen part of the audio silent. Inspired by https://arxiv.org/pdf/1904.08779.pdf
Input-output example
Here we silence a part of a speech recording.
Input sound | Transformed sound |
---|---|
Usage example
from audiomentations import TimeMask
transform = TimeMask(
min_band_part=0.1,
max_band_part=0.15,
fade=True,
p=1.0,
)
augmented_sound = transform(my_waveform_ndarray, sample_rate=16000)
TimeMask API
min_band_part
:float
• range: [0.0, 1.0]- Default:
0.0
. Minimum length of the silent part as a fraction of the total sound length. max_band_part
:float
• range: [0.0, 1.0]- Default:
0.5
. Maximum length of the silent part as a fraction of the total sound length. fade
:bool
- Default:
False
. When set toTrue
, a linear fade-in and fade-out is added to the silent part. This can smooth out unwanted abrupt changes between consecutive samples, which might otherwise sound like transients/clicks/pops. p
:float
• range: [0.0, 1.0]- Default:
0.5
. The probability of applying this transform.