資源簡介
語音端點檢測--倒譜、譜熵、分形
是轉載的,有三種方法實現語音的端點檢測。
雙門限
譜熵
盒維數法

代碼片段和文件信息
clear;
Winsiz=256;%幀長
Shift=128;%幀移
[xFs]=wavread(‘changdu.wav‘);
%?len=length(x1);
%?nois=0.001*rand(len1);
%?x=x1+nois;
x=double(x);
x=x/max(abs(x));
%對信號做預加重處理
x=filter([1?-0.9375]?1?x);
nseg=floor((length(x)-Winsiz)/Shift)+1;
A=zeros(Winsiz/2+1nseg);
for?i=1:nseg
??n1=(i-1)*Shift+1;n2=n1+(Winsiz-1);
??xx=x(n1:n2);
??%求lpc系數
??[are]=lpcauto(xx);
??%ar?=?LPC(xx12);
??lpc=ar(2:13);
??%求解lpc倒譜?
??lpcc(i:)=lpc2lpcc(lpc);
end
[mn]=size(lpcc);
C=mean(lpcc(2:30:));%背景噪聲倒譜系數估計值
for?i=1:m
????s=0;
?????for?j=2:n
????????s=s+(lpcc(ij)-C(j)).^2;%計算倒譜距離
?????end
????????s=2*s+(lpcc(i1)-C(1))^2;
????dst(i)=4.3429*sqrt(s);
end
dst=dst./max(dst);
%--------------------------------------------------------
T1=0.013;
T2=0.012;
maxsilence=5;
minlen=10;
T1?=?min(T1?max(dst)/4);
T2?=?min(T2?max(dst)/8);
status=0;
count=0;
silence=0;
%開始端點檢測
x1?=?0;?
x2?=?0;
xn=1;
for?n=1:length(dst)?????????????%xn記錄連續語音中字的段數(幾個字)??
???switch?status
???case?{01}???????????????????%?0?=?靜音?1?=?可能開始
??????if?dst(n)?>?T1??????????%?確信進入語音段
?????????x1(xn)?=?max(n-count(xn)-11);
?????????status??=?2;
?????????%silence(xn)?=?0;
?????????count(xn)???=?count(xn)?+?1;
??????elseif?dst(n)?>?T2??%?可能處于語音段
?????????status?=?1;
?????????count(xn)=count(xn)?+?1;
??????else???????????????????????%?靜音狀態
?????????status??=?0;
?????????count(xn)=0;
?????????silence(xn)=0;
?????????x1(xn)=0;
?????????x2(xn)=0;
??????end
???case?2???????????????????????%?2?=?語音段
??????if?dst(n)?>?T2?????%?保持在語音段
?????????count(xn)?=?count(xn)?+?1;
??????else???????????????????????%?語音將結束
?????????silence(xn)??=?silence(xn)?+1;
?????????if?silence(xn)?????????????count(xn)??=?count(xn)?+?1;
?????????elseif?count(xn)?????????????status??=?0;
????????????silence(xn)=0;?????????
?????????else????????????????????%?語音結束
????????????status??=?3;
?????????end
??????end
???case?3???????
????????status??=?0;??????????
????????xn=xn+1;?
????????count(xn)???=?0;
????????silence(xn)=0;
????????x1(xn)=0;
????????x2(xn)=0;
???end
end???
%--------------以下繪圖程序
frameInc=Shift;
count?=?count-silence./2;
x2?=?x1?+?count?-1;
subplot(211);
plot(x);
axis([1?length(x)?-1?1]);
ylabel(‘Speech‘);
for(xn=1:length(x1))
line([x1(xn)*frameInc?x1(xn)*frameInc][-1?1]‘Color‘‘red‘);
line([x2(xn)*frameInc?x2(xn)*frameInc][-1?1]‘Color‘‘green‘);
end;
subplot(212);
plot(dst);
axis([1?length(dst)?min(dst)?max(dst)]);
ylabel(‘Cepstrum‘);
for(xn=1:length(x1))
line([x1(xn)?x1(xn)][min(dst)max(dst)]‘Color‘‘red‘);
line([x2(xn)?x2(xn)][min(dst)max(dst)]‘Color‘‘green‘);
end;
%?Shanglevel=0.25;%選取適當閾值
%?windowsize=Winsiz;
%?overlap=Shift;
%?sound?=?[];
%?k=1;
%?%找到滿足閾值條件的下標索引值
%?soundIndex?=?find(dst(2:end)>=Shanglevel);
%?sound(k).begin?=?soundIndex(1);
%?for?i=2:length(soundIndex)-2
%? if?soundIndex(i+1)-soundIndex(i)>1?&&?soundIndex(i+2)-soundIndex(i+1)=
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????27098??2007-12-20?15:24??endpoint?detection\倒譜\changdu.wav
?????文件???????4192??2007-12-24?09:41??endpoint?detection\倒譜\daopu.asv
?????文件???????3986??2009-04-20?09:14??endpoint?detection\倒譜\daopu.m
?????文件????????991??2007-12-19?09:41??endpoint?detection\倒譜\lpc2lpcc.asv
?????文件????????941??2007-12-19?16:51??endpoint?detection\倒譜\lpc2lpcc.m
?????文件???????2918??2007-12-17?09:30??endpoint?detection\倒譜\lpcauto.asv
?????文件???????2031??2007-12-17?09:38??endpoint?detection\倒譜\lpcauto.m
?????文件??????17642??2007-12-19?09:35??endpoint?detection\倒譜\r2.wav
?????文件??????15644??2007-12-19?18:42??endpoint?detection\倒譜\t1.wav
?????文件?????158838??2007-12-20?15:58??endpoint?detection\倒譜\test.wav
?????文件????????139??2007-12-21?16:29??endpoint?detection\倒譜\說明.txt
?????文件??????27098??2007-12-20?15:24??endpoint?detection\分形\changdu.wav
?????文件????????485??2007-12-19?19:56??endpoint?detection\分形\corr_integral.m
?????文件???????2891??2009-04-21?11:51??endpoint?detection\分形\fenxingtest.m
?????文件???????1508??2007-12-24?16:29??endpoint?detection\分形\FractalDim.m
?????文件????????980??2007-12-19?20:01??endpoint?detection\分形\GP_CD.m
?????文件????????286??2007-12-19?19:36??endpoint?detection\分形\heaviside.m
?????文件??????56622??1997-05-06?23:54??endpoint?detection\分形\kdt_003.wav
?????文件??????33938??2009-03-23?14:57??endpoint?detection\分形\s1.wav
?????文件?????158838??2007-12-20?15:58??endpoint?detection\分形\test.wav
?????文件??????25088??2007-12-26?16:17??endpoint?detection\說明.doc
?????文件??????27098??2007-12-20?15:24??endpoint?detection\譜熵\changdu.wav
?????文件???????4450??2007-12-24?21:01??endpoint?detection\譜熵\pushang.asv
?????文件???????3103??2007-12-26?16:31??endpoint?detection\譜熵\pushang.m
?????文件??????17642??2007-12-19?09:35??endpoint?detection\譜熵\r2.wav
?????文件??????15644??2007-12-19?18:42??endpoint?detection\譜熵\t1.wav
?????文件?????158838??2007-12-20?15:58??endpoint?detection\譜熵\test.wav
?????文件????????107??2007-12-24?10:45??endpoint?detection\譜熵\說明.txt
?????目錄??????????0??2009-04-20?09:02??endpoint?detection\倒譜
?????目錄??????????0??2009-04-21?10:24??endpoint?detection\分形
............此處省略5個文件信息
評論
共有 條評論