trim(A ⟨,threshold ⟨,mavglen ⟩
⟩ ⟨,left|right ⟩ ⟨,index ⟩)
finds the start l of the first nonsilent portion of A and the start u of the trailing
silence (in samples). Audio is considered silent at offset k if the instantaneous energy at
k is below threshold decibels.
The energy vector is smoothed out by applying a moving-average filter with length
n=⌊ samplerate(A)·mavglen+1/2⌋
(i.e. the length in samples corresponding to mavglen seconds).
To disable the filtering, set mavglen to 0.If index is given, then the return value is either l if left is given,
u if right is given, or (l,u−l) otherwise (the last sequence contains the
start and length of the nonsilent part, in samples). If index is omitted, then
the return value is an audio clip obtained from A by removing either the leading silence
if left is given, trailing silence if right is given, or both leading
and trailing silence otherwise.