📄 durbin.m
字号:
% MATLAB SIMULATION OF NSA FS-1016 CELP v3.2
% COPYRIGHT (C) 1995-99 ANDREAS SPANIAS AND TED PAINTER
%
% This Copyright applies only to this particular MATLAB implementation
% of the FS-1016 CELP coder. The MATLAB software is intended only for educational
% purposes. No other use is intended or authorized. This is not a public
% domain program and distribution to individuals or networks is strictly
% prohibited. Be aware that use of the standard in any form is goverened
% by rules of the US DoD. Therefore patents and royalties may apply to
% authors, companies, or committees associated with this standard, FS-1016. For
% questions regarding the MATLAB implementation please contact Andreas
% Spanias at (602) 965-1837. For questions on rules,
% royalties, or patents associated with the standard, please contact the DoD.
%
% ALL DERIVATIVE WORKS MUST INCLUDE THIS COPYRIGHT NOTICE.
%
% ******************************************************************
% DURBIN
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 6-8-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Durbin recursion: Uses autocorrelation lags to solve for predictor
% coefficients
%
% DESIGN NOTES
%
% This performs the classical Durbin recursion on the correlation
% sequence r(0), r(1), r(2) . . . to obtain n reflection coefficients (rc).
%
% The sign convention used defines the first reflection coefficient
% as the normalized first autocorrelation coefficient, which results
% in positive values of rc(0) for voiced speech.
%
% REFERENCES
%
% Parsons, Voice and Speech Processing, McGraw-Hill, 1987, p. 160 & 378.
%
% VARIABLES
%
% INPUTS
% c0 - Autocorrelation low order lag, r(0)
% c - Higher order autocorrelation lags, r(1) - r(n)
% n - Predictor order
%
% OUTPUTS
% a - LPC coefficients (1 to n+1) (direct form predictor)
%
% INTERNALS
% i - Index of recursion
% rc - Reflection coefficients
% alpha - Intermediate result of recursion
% beta - Intermediate result of recursion
% tmp - Intermediate result of recursion
%
% GLOBALS
% MAXNO - LPC predictor order
%
% ******************************************************************
function a = durbin( c0, c, a, n )
% DECLARE GLOBAL CONSTANTS
global MAXNO
% INIT LOCAL VARIABLES
rc = zeros( MAXNO, 1 );
tmp = zeros( MAXNO, 1 );
% TRAP ZERO ENERGY CONDITION
if c0 <= 0.00
rc( 1:n ) = 0.00;
return
end
% INITIALIZATION
alpha = c0;
a(2) = -c(1) / c0;
rc(1) = a(2);
beta = c(1);
% RECURSION
for i = 1:n-1
alpha = alpha + ( beta * rc(i) );
beta = c( i+1 );
beta = beta + sum( c( 1:i ) .* a( i+1:-1:2 ) );
rc( i+1 ) = -beta / alpha;
tmp( 1:i ) = rc( i+1 ) .* a( i+1:-1:2 );
a( 2:i+1 ) = a( 2:i+1 ) + tmp( 1:i );
a( i+2 ) = rc( i+1 );
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -