Trim
Added in v0.7.0
Trim leading and trailing silence from an audio signal using librosa.effects.trim. It considers threshold
(in Decibels) below reference defined in parameter top_db as silence.
Input-output example
In this example we remove silence from the start and end, using the default top_db parameter value

| Input sound | Transformed sound |
|---|---|
Usage example
from audiomentations import Trim
transform = Trim(
top_db=30.0,
p=1.0
)
augmented_sound = transform(my_waveform_ndarray, sample_rate=16000)
Trim API
top_db:float• unit: Decibel- Default:
30.0. The threshold value (in Decibels) below which to consider silence and trim. p:float• range: [0.0, 1.0]- Default:
0.5. The probability of applying this transform.