• 大小: 299KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: 其他
  • 标签: 语音  端点检测  

资源简介

语音端点检测--倒谱、谱熵、分形 是转载的,有三种方法实现语音的端点检测。 双门限 谱熵 盒维数法

资源截图

代码片段和文件信息

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) < maxsilence % 静音还不够长,尚未结束
            count(xn)  = count(xn) + 1;
         elseif count(xn) < minlen   % 语音长度太短,认为是噪声
            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个文件信息

评论

共有 条评论