Matlab implementation of Zero Frequency Filter

11 views (last 30 days)
I am working on glottal analysis of speech signal and wanted to reproduce a result published in a paper where ZFF filter is used for GCIs and GOIs detection. I implemented their algorithm but am not able to view a similar result. Do any one have a matlab implementation for the same. I am referring the below paper.
"Characterization of Glottal Activity From Speech Signals" by K. Sri Rama Murty, B. Yegnanarayana, Senior Member, IEEE, and M. Anand Joseph
My code is as follow :
clear all;clc;close all;
%generating a signal
for i = 1:10 s((1+(i-1)*10),1)=10; s((5+(i-1)*10),1)=5; end
s = awgn(s,10);
for i = 2 : length(s) x(i,1)= s(i,1)-s(i-1,1); end
%zero_frequency_filter implementation
for i = 1:length(x) if (i-4)> 0 y(i,1)=4*y(i-1,1)-6*y(i-2,1)+4*y(i-3,1)-1*y(i-4,1)+x(i,1); else y(i,1)= x(i,1); end end
pitch_period = 14;
%finding the mean for each sample
for i = 1:length(x) sum(i,1)=0; for m = -(pitch_period):pitch_period
if (i+m > 0) && (i+m <= length(y))
sum(i,1)= sum(i,1)+y(i+m);
elseif (i+m <= 0)
sum(i,1) = sum(i,1);
elseif (i+m > length(y))
sum(i,1) = sum(i,1);
end
end
avg(i,1)= (1/((2*pitch_period)+1))*sum(i,1);
end
for i = 1:length(y) ynot(i,1)= y(i,1)- avg(i,1); end
According to the result published in the paper, I should be expecting a sine wave kind of curve but I am finding nothing sort of that.

Answers (2)

Mark
Mark on 20 Apr 2018

I too struggled with this algorithm. The problem I had was that the resonators on the unit circle caused numerically instability. In the end I used the form of ZFF described here:

   * IEEE TRANSACTIONS ON AUDIO, SPEECH, AND LANGUAGE PROCESSING, VOL. 20, NO. 9, NOVEMBER 2012 2613
   * An FIR Implementation of Zero Frequency Filtering of Speech Signals
   * Kruthiventi S. S. Srinivas and Kishore Prahallad

This seemed to work well for my (C language) implementation.

Mark Huckvale


Moulvi Faizan Ahmed
Moulvi Faizan Ahmed on 23 Aug 2019
Edited: Moulvi Faizan Ahmed on 23 Aug 2019
I recently tried implementing the same thing which you did and was facing the same issue.
%main code
Fs=48000;
samples=[(2)*Fs,(3)*Fs];
[y,fs]=audioread("song.mp3",samples);
t=[1:size(y,1)];
x=y-delayseq(y,1);
sound(y,fs);
out2=filter(Hd,x);
meanfilt=meansig(out2,0.015*Fs);
ynot=out2-meanfilt;
plot(t,out2,t,meanfilt);
where i defined a function called meansig which is implementation of trend removal operation as mentioned in paper.
%Trend Removal function
function y=meansig(s,n)
x=s(1:length(s),1);
sig1=transpose(x);
temp1=zeros(1,length(sig1));
for i=1:n
sx=shiftfun(sig1);
temp1=temp1+sx;
sig1=sx;
end
sig2=transpose(x);
temp2=zeros(1,length(sig2));
for i=1:n
sx=shiftfun2(sig2);
temp2=temp2+sx;
sig2=sx;
end
y=temp1+temp2+transpose(x)./((2*n)+1);
shiftfun and shiftfun2 are another two functions which I used to shiftright and shiftleft respectively.
%shiftleft function
function y=shiftfun(x)
temp=[0,x(1:length(x))];
temp=temp(1:length(temp)-1);
y=temp;
%shiftright function
function y=shiftfun2(x)
temp=[x(2:length(x)),0];
y=temp;
Anyone Please help and tryna answer what is wrong with this method why it is not working ? or if anyone else has faced the same issue.

Community Treasure Hunt

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

Start Hunting!