MATLAB: How to remove silent regions from speech signal dynamically

removing silence regionsspeech processingspeech signal

%program to remove silences from a speech recording %step 1- break the signal into frames of 0.1seconds fs=11250; %fs=22050; frame_duration=0.1; frame_len=frame_duration*fs; N=length(ip); num_frames=floor(N/frame_len); new_sig=zeros(N,1); count=0; %frame1=ip(1:frame_len); %frame2=ip(frame_len+1 :frame_len*2) %frame3=ip(frame_len*2+1 :frame_len*3) for k=1:num_frames %extract a frame of speech frame=ip( (k-1) *frame_len +1 : frame_len*k); %step2 – identify silence by finding frames with max amplitude less than 0.03
max_val=max(frame);
if(max_val>0.03) %this frame is not silent count=count+1;
new_sig( (count-1)*frame_len +1 :frame_len*count)=frame;
end end
here 0.03 is set as threshold instead how can we do it dynamically.
Thank you

Best Answer

Would this "File Exchange Pick of the Week" be of any use to identify and discriminate between silence and valid sounds: http://blogs.mathworks.com/pick/2014/05/23/automatic-activity-detection-using-hilbert-transform/
Related Question