地址::http://blog.sina.com.cn/s/blog_892508d501012hzg.html
这一段时间对现代滤波进行了学习,对自适应滤波器和卡尔曼滤波器有了一定认识,并对它们用MATLAB对语音信号进行了滤波,发现卡尔曼滤波器还是比较有用,能够在较大的噪声中还原原来的信号。新的学期马上就开始了,由于TI的开发板一直在维修,所以学习TI开发板的计划搁置,但是对声音信号的处理及滤波器的认识有了进一步提高。新的学期继续努力!
语音信号在较长时间内是非平稳的,但在较短的时间内的一阶统计量和二阶统计量近似为常量,因此语音信号在相对较短的时间内可以看成白噪声激励以线性时不变系统得到的稳态输出。假定语音信号可看成由一AR模型产生:
其中
、分别为过程模型噪声协方差和测量模型噪声协方差,测量协方差可以通过观测得到,则较难确定,在本实验中则通过与两者比较得到。
MATLAB程序实现如下:
%%%%%%%%%%%%%%%%%基于LPC全极点模型的最大后验概率估计法,采用卡尔曼滤波%%%%%%%%%%%%%%
clear;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%加载声音数据%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load voice.mat
y=m1(2,:);
x=y+0.08*randn(1,length(y));
%%%%%%%%%%%%%%%原声音信号和加噪声后的信号%%%%%%%%%%%%%%%
figure(1);
subplot(211);plot(m1(1,:),m1(2,:));xlabel('时间');ylabel('幅度');title('原声音信号');
subplot(212);plot(m1(1,:),x);xlabel('时间');ylabel('幅度');title('加噪声后的信号');
%%%%%%%%%%%%%%%%%%%%%%%%%输入参数%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Fs=44100;
bits=16;
N=256;
m=N/2;
lenth=length(x);
count=floor(lenth/m)-1;
p=11;
a=zeros(1,p);
w=hamming(N);
y_temp=0;
F=zeros(11,11);
F(1,2)=1;
F(2,3)=1;
F(3,4)=1;
F(4,5)=1;
F(5,6)=1;
F(6,7)=1;
F(7,8)=1;
F(8,9)=1;
F(9,10)=1;
F(10,11)=1;
H=zeros(1,p);
S0=zeros(p,1);
P0=zeros(p);
S=zeros(p);
H(11)=1;
s=zeros(N,1);
G=H';
P=zeros(p);
%%%%%%%%%%%%%%%%测试噪声协方差%%%%%%%%%%%%%%%%%%%%%%
y_temp=cov(x(1:7680));
x_frame=zeros(256,1);
x_frame1=zeros(256,1);
T=zeros(lenth,1);
for r=1:count
%%%%%%%%%%%%%%%%%%%5%%%%%分帧处理%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%采用LPC模型求转移矩阵参数%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%帧长内过程噪声协方差%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%对得到的每帧数据进行加窗操作%%%%%%%%%%%%%%%%%%%%%%%%
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%合帧操作%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2)
subplot(211);plot(m1(1,:),m1(2,:));xlabel('时间');ylabel('幅度');title('原声音信号');
subplot(212);plot((1:1109760)/Fs,s_out);xlabel('时间');ylabel('幅度');title('经卡尔曼滤波后的声音信号');