silence detection using std and mean of the entire audio

2 次查看(过去 30 天)
Hello everone,
I have a problem getting a proper result from this code. at the the code, I get a tic tic sound instead of a voice. could you please help me with the code.
clc
my_audio = audioread('recvoice.wav');
fs = 16000;
f_dur = 0.1;
f_len = f_dur * fs;
N = length(my_audio);
no_frames = floor(N/f_len);
new_data = zeros(N,1);
count=0;
avg_noise = mean(my_audio); % calculating the average of the whole signal
std_noise = std(my_audio); %calculating the std of the whole sig
for j=1:f_len:length(my_audio)
for k=j:j+f_len-1
b(k) = (my_audio(k)-(avg_noise))/std_noise;
if b(k) > 3*std_noise
count = count+1;
new_data((count-1)*f_len+1:count*f_len)=my_audio(k);
end
end
end
figure(1);
plot(my_audio);
figure(2);
plot(new_data);
sound(my_audio);
pause(5);
sound(new_data);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by