[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUDITORY] Cut silence in beginning and end of speech recordings automatically?



Dear Tamar,

In MATLAB I recommend the following (this assumes a monaural sound (one column vector), so you have to adjust it for stereo sounds):

[insig,fs] = audioread(file2load);

Ma_amplitude = max(abs(insig)); % maximum absolute amplitude
dB_below = 100; % dB below the maximum amplitude to look for...
Mi_amplitude = Ma_amplitude*10^(-dB_below/20);
idx_i = find(abs(insig1)>=Mi_amplitude,1,'first'); % first sample with absolute value above Mi_amplitude
idx_f = find(abs(insig1)<=Mi_amplitude,1,'last'); % last sample with absolute value above Mi_amplitude
insig_cut = insig(idx_i:idx_f);

I hope it is intuitive. If you are conservative you can set the "dB_below" to cut amplitudes 100 dB the maximum value but it could be good enough to use 60 dB of 40 dB, just make sure you don't get clips when reproducing the resulting files...

Cheers,
Alejandro

Op vr 5 mrt. 2021 om 06:25 schreef Tamar Regev <tamaregev@xxxxxxxxx>:
Hi all,

Does anyone know of a good way to automatically trim silent parts (which may contain some minor background noise) at the beginning and end of speech recordings?

Preferentially using Matlab but any other automatic way would work (we want to run this on many sound files).

Thanks a lot!
Tamar