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

📄 lpc_h.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
% LPC_H : find the flexsible-order linear prediction coefficients.
% Function: lpc_h(sso,order) returns the linear prediction coefficients,
%           first-order reflection coefficient, energy of the signal, 
%           redidue signal, and the standard deviation of prediction error.
% Usage: [cofa,rc1,energy,residue,npow]=lpc_h(sso,order);
% Input : 
%	sso = analyzed speech signal.
%       order = analysis order.
% Output :
% 	cofa = AR cofficients.
% 	rc1 = first-order reflection coefficient.
% 	energy = energy of the underlying speech segment.
% 	residue = prediction error.
%	npow = standard deviation of prediction error.
% Original: lpc.m by Dr.Hu; the oly difference is that the order is user 
%           selected instead of fixed as 13.

function [cofa,rc1,energy,residue,npow]=lpc_h(sso,order);


sso=sso(:);
sso1=sso(order+1:length(sso));
energy=sso1'*sso1;
rc1=sso1(1:length(sso1)-1)'*sso1(2:length(sso1))/energy;
ssa=filter([1 -rc1],1,sso);  % Prefiltering
ssa=ssa(2:length(ssa));
maxordera =order-1; % maxorder = desired order - 1
N=length(ssa)-maxordera;


for k=1:maxordera+1
	U(1:N,k) =ssa(k:N+k-1);
end;

% Performing LP analysis using the orthogonal covariance method.
% For details, please refer to Section 4.1.1 of Hu's dissertation.

V(:,1)=U(:,1);
rp(1)=V(:,1)'*V(:,1);
for k=1:maxordera+1
	V(:,k)=U(:,k);
	for i=1:k-1
		B(k,i)=(U(:,k)'*V(:,i))/(V(:,i)'*V(:,i));
		V(:,k)=V(:,k)-B(k,i)*V(:,i);
	end
		B(k,k)=1;
%	rp(k)=(V(:,k)'*V(:,k));
%	AIC(k)=N*log(rp(k))+(k-1)*log(N);
% where AIC stands for the modified Akaike Information Criterion
end;

ordera=order;


residue=V(1:length(V), ordera).';
ordera=ordera-1;
bb= B(1:ordera,1:ordera);
invB=inv(bb);
pb=B(ordera+1,1:ordera);
cofb=pb*invB;
cofa=[1 -cofb(ordera:-1:1)];

% Stablize the synthesis filter
cofa=conv([1 -rc1],polystab(cofa));

npow=sqrt((residue*residue'));  % mean of 'residue' is assumed to be zero.

⌨️ 快捷键说明

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