⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.m

📁 关于双门限法的语音端点检测
💻 M
字号:
clc;
clear;
%x=wavread('01.wav');                  %读取语音文件
x=wavread('a.wav');
N=200;                                %设定帧长
M=80;                                 %设定个帧交叠部分的长度  
xn=enframe(x,N,M);                    %按照指定的要求分帧
%size(xn)

s=xn(:,70);                           %取分帧后的某一帧进行分析
n=length(s);

p=18;
num=512;                              %设定频谱的点数
a=lpc_coefficients(s,p);              %按所要求阶数求线性预测系数
a2 =lpc(s,p);                         %利用信号处理工具箱中的函数lpc求预测系数

cm=cepstrum(s);                       %求语音信号的倒谱
h_c=lpc_cepstrum(s,p);                %求lpc倒谱,即声道冲激响应h(n)的倒谱
Hw=lpc_spectrum(s,p,num);             %求lpc的谱估计,num为频谱的点数
[P_w,Q_w,H]=lsp(s,p,num);             %求语音信号的线谱对参数

colordef black;                       %设置背景颜色为黑色
choice=4;

if choice==1
    clf;                              %清除当前的图形窗口
    subplot(2,1,1);
    plot(a);
    title('我程序求得的预测系数');
    subplot(2,1,2);
    plot(-a2(2:p+1),'y')
    title('Matlab函数求得的预测系数');    
elseif choice==2
    clf;                              %清除当前的图形窗口
    subplot(2,1,1);
    plot(cm(2:n),'y');
    title('语音信号的倒谱');
    subplot(2,1,2);
    plot(h_c,'y');
    title('lpc倒谱');
elseif choice==3
    clf;                              %清除当前的图形窗口
    subplot(2,1,1);
    Sw=abs(fft(s,num));               %语音信号的短时谱
    axis([0 256 0 1]);
    hold on;
    plot(Sw/max(Sw),'y');
    title('语音信号的短时谱');
    subplot(2,1,2);
    axis([0 256 0 1]);
    hold on
    plot(Hw/max(Hw),'y');
    
    title('lpc谱估计');
else
    clf;                              %清除当前的图形窗口
    subplot(3,1,1);
    stem(Q_w,zeros(p/2,1),'r','fill');
    hold on;
    stem(P_w,zeros(p/2,1),'y','fill');
    title('线谱对系数');
    hold off;
    subplot(3,1,2);
    axis([0 256 0 1]);
    hold on
    plot(abs(Hw)/max(abs(Hw)),'y');
    title('lpc谱估计');
    subplot(3,1,3);
    axis([0 256 0 1]);
    hold on
    plot(H/max(H),'y');               
    title('由线谱对求得的谱估计');
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -