Subject: Re: [AUDITORY] Cut silence in beginning and end of speech recordings automatically? From: Ale Osses <ale.a.osses@xxxxxxxx> Date: Fri, 5 Mar 2021 11:26:21 +0100--0000000000009093bf05bcc7845e Content-Type: text/plain; charset="UTF-8" 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@xxxxxxxx>: > 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 > > --0000000000009093bf05bcc7845e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Dear Tamar,<div><br></div><div>In MATLAB I recommend the f= ollowing (this assumes a monaural sound (one column vector), so you have to= adjust=C2=A0it for stereo sounds):</div><div><br></div><div>[insig,fs] =3D= audioread(file2load); <br><br>Ma_amplitude =3D max(abs(insig)); % maximum = absolute amplitude<br>dB_below =3D 100; % dB below the maximum amplitude to= look for...<br>Mi_amplitude =3D Ma_amplitude*10^(-dB_below/20);<br>idx_i = =3D find(abs(insig1)>=3DMi_amplitude,1,'first'); % first sample = with absolute value above Mi_amplitude<br>idx_f =3D find(abs(insig1)<=3D= Mi_amplitude,1,'last'); % last sample with absolute value above Mi_= amplitude<br>insig_cut =3D insig(idx_i:idx_f);<br></div><div><br></div><div= >I hope it is intuitive. If you are conservative you can set the "dB_b= elow" 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 r= eproducing the resulting files...</div><div><br></div><div>Cheers,</div><di= v>Alejandro</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" clas= s=3D"gmail_attr">Op vr 5 mrt. 2021 om 06:25 schreef Tamar Regev <<a href= =3D"mailto:tamaregev@xxxxxxxx">tamaregev@xxxxxxxx</a>>:<br></div><bloc= kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:= 1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Hi all,<div><= br></div><div>Does anyone know of a good way to automatically trim silent p= arts (which may contain some=C2=A0minor background noise) at the beginning = and end of speech recordings?</div><div><br></div><div>Preferentially using= Matlab but any other automatic way would work (we want to run this on <u>m= any</u> sound files).</div><div><br></div><div>Thanks a lot!</div><div>Tama= r</div><div><br></div></div> </blockquote></div> --0000000000009093bf05bcc7845e--