Home > voicebox > lpcar2cc.m

# lpcar2cc

## PURPOSE

LPCAR2CC LPC: Convert AR filter to complex cepstrum [CC,C0]=(AR,NP)

## SYNOPSIS

function [cc,c0]=lpcar2cc(ar,np)

## DESCRIPTION

```LPCAR2CC LPC: Convert AR filter to complex cepstrum [CC,C0]=(AR,NP)

Inputs: ar(nf,n+1)   AR coefficients, one frame per row
np           Number of cepstral coefficients to calculate [n]

Outputs: cc(nf,np)    Complex cepstral coefficients, excluding c(0)
c0(nf,1)     Coefficient c(0)

The "complex cepstral coefficients", cc(n), are the inverse discrete-time Fourier transform
of the log of the complex-valued spectrum. The cc(n) are real-valued and, for n<0, cc(n)=0.
The "real cepstral coeffcients", rc(n), are the inverse discrete-time Fourier transform
of the log of the magnitude spectrum; rc(0)=cc(0) and rc(n)=0.5*cc(n) for n~=0.```

## CROSS-REFERENCE INFORMATION

This function calls:
• lpccc2pf LPCCC2PF Convert complex cepstrum to power spectrum PF=(CC,NP,NC)
This function is called by:
• lpccc2cc LPCCC2PF Extrapolate complex cepstrum C=(CC)

## SOURCE CODE

```0001 function [cc,c0]=lpcar2cc(ar,np)
0002 %LPCAR2CC LPC: Convert AR filter to complex cepstrum [CC,C0]=(AR,NP)
0003 %
0004 %  Inputs: ar(nf,n+1)   AR coefficients, one frame per row
0005 %          np           Number of cepstral coefficients to calculate [n]
0006 %
0007 % Outputs: cc(nf,np)    Complex cepstral coefficients, excluding c(0)
0008 %          c0(nf,1)     Coefficient c(0)
0009 %
0010 % The "complex cepstral coefficients", cc(n), are the inverse discrete-time Fourier transform
0011 % of the log of the complex-valued spectrum. The cc(n) are real-valued and, for n<0, cc(n)=0.
0012 % The "real cepstral coeffcients", rc(n), are the inverse discrete-time Fourier transform
0013 % of the log of the magnitude spectrum; rc(0)=cc(0) and rc(n)=0.5*cc(n) for n~=0.
0014
0015 %      Copyright (C) Mike Brookes 1998-2014
0016 %      Version: \$Id: lpcar2cc.m 5025 2014-08-22 17:07:24Z dmb \$
0017 %
0018 %   VOICEBOX is a MATLAB toolbox for speech processing.
0020 %
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 %   This program is free software; you can redistribute it and/or modify
0023 %   it under the terms of the GNU General Public License as published by
0024 %   the Free Software Foundation; either version 2 of the License, or
0025 %   (at your option) any later version.
0026 %
0027 %   This program is distributed in the hope that it will be useful,
0028 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0029 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0030 %   GNU General Public License for more details.
0031 %
0032 %   You can obtain a copy of the GNU General Public License from
0033 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0034 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036
0037 [nf,p1]=size(ar);
0038 p=p1-1;
0039 if (nargin<2) np=p; end
0040 cc=zeros(nf,np);
0041 if any(ar(:,1)~=1)
0042     c0=-log(ar(:,1));
0043     ar=ar./ar(:,ones(1,p1));
0044 else
0045     c0=zeros(nf,1);
0046 end
0047 cm=(1:np).^(-1);
0048 if np>p
0049     xm=-(1:p);
0050     nz=np-p;
0051     for k=1:nf
0052         cc(k,:)=filter(1,ar(k,:),[ar(k,2:p1).*xm zeros(1,nz)]).*cm;
0053     end
0054 else
0055     p1=np+1;
0056     xm=-(1:np);
0057     for k=1:nf
0058         cc(k,:)=filter(1,ar(k,:),ar(k,2:p1).*xm).*cm;
0059     end
0060 end
0061 if ~nargout
0062     lpccc2pf(cc,[],[],c0);
0063 end```

Generated on Mon 06-Aug-2018 14:48:32 by m2html © 2003