📄 xnneframe.m
字号:
function [NE, SE, M]=xNNEframe(speechframe, Tp)
% Input
% speechframe : A frame of speech signal to be analyzed
% Tp : pitch period of the input frame
% Output
% NE : energy of the noise in the frequency range
% from approximately 1 kHz to 5 kHz
% SE : energy of the signal in the same frequency range
%
N=2048;
len=length(speechframe);
wframe=speechframe.*hamming(len);
pad=zeros(N,1);
pad(1:len)=wframe;
X=fft(pad,N);
X=X.*conj(X);
X=X(1:N/2);
f=N/Tp;
lobe=round(2*N/M);
i=1;
a=round(0.8*f);
low=a;
b=round(1.3*f);
while b < 0.9*N/2
[p,ploc]=max(X(a:b));
ploc=ploc+a-1;
if last -b <= lobe
break;
else
peaklocs(i)=ploc;
i=i+1;
c=round(f*i)+1;
a=round(f+ploc)-lobe;
b=a+2*lobe;
end
end
ifirst=round(1000*N/(Fs*f));
first=peaklocs(ifirst)+lobe+1;
ilast=i-1;
last=peaklocs(ilast)-lobe;
if min(diff(peaklocs(ifirst:ilast)))-2*lobe < 1
M=4*N/(2*eps+min(diff(peaklocs(ifirst:ilast)))-2);
NE=0;
SE=0;
else
a=first;
b=peaklocs(ifirst+1)-lobe;
NE=sum(X(a:b));
meanNE=mean(X(a:b));
begin=ifirst+1;
for i=begin:ilast-1
a=peaklocs(i)-lobe+1;
b=peaklocs(i+1)-lobe;
dipwidth=b-a+1;
m=mean(X(a:b));
NE=NE+m*dipwidth+lobe*(meanNE+m);
meanNE=m;
end
end
SE=sum(X(first:last));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -