I am writing a code to detect voiced vs un-voiced segment in a signal. I believe I have the correct approach and code. However, I am having difficulty trying to overlay the original signal and the zero crossing rate in the same plot. I need this to test, how effective the zero crossing rate is.
Additionally, is there any normalization that I may be missing ?
% Algorithm to identify presence of voice activity using zero crossing rate and energy
% of speech signal
clear all; clc; close all;
%% Read the input signal
[y, fs] = audioread('ISTS-16s-44100.wav');
N = length(y);
t = (0:N-1)/fs;
framelen = 128;
numframes = floor(N/framelen);
overlap = 0;
zcr = [];
for k = 1:numframes
arry = [];
zcr_frame = [];
frame = y((k-1)*framelen+1 : framelen*k) ;
for i = 2:length(frame)
arry(i) = sgn(frame(i)) – sgn(frame(i-1));
end
zcr_frame = sum(abs(arry));
zcr = [zcr zcr_frame] ;
end
figure (1); clf; hold on;
grid on;
plot(t,y);
xlabel('time(secs)'); ylabel('linear output')
t_zcr = (0:framelen:N-framelen)/fs ;
plot(t_zcr,zcr);
Best Answer