Home > voicebox > lpcpf2cc.m

lpcpf2cc

PURPOSE ^

LPCPF2CC Convert power spectrum to complex cepstrum CC=(PF,NP)

SYNOPSIS ^

function [cc,c0]=lpcpf2cc(pf,np,f)

DESCRIPTION ^

LPCPF2CC Convert power spectrum to complex cepstrum CC=(PF,NP)

  Inputs: pf(nf,n)    Power spectrum, uniformly spaced DC to Nyquist
          np          Number of cepstral coefficients to calculate [n-1]
          f(1,n)      Frequencies of pf columns [linspace(0,0.5,n)]

 Outputs: cc(nf,np)  Complex spectrum from DC to Nyquist
          c0(nf,1)   The zeroth cepstral coefficient, c(0)

 Note since the log spectrum is not normally bandlimited, this conversion is not exact unless n >> np

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [cc,c0]=lpcpf2cc(pf,np,f)
0002 %LPCPF2CC Convert power spectrum to complex cepstrum CC=(PF,NP)
0003 %
0004 %  Inputs: pf(nf,n)    Power spectrum, uniformly spaced DC to Nyquist
0005 %          np          Number of cepstral coefficients to calculate [n-1]
0006 %          f(1,n)      Frequencies of pf columns [linspace(0,0.5,n)]
0007 %
0008 % Outputs: cc(nf,np)  Complex spectrum from DC to Nyquist
0009 %          c0(nf,1)   The zeroth cepstral coefficient, c(0)
0010 %
0011 % Note since the log spectrum is not normally bandlimited, this conversion is not exact unless n >> np
0012 
0013 %      Copyright (C) Mike Brookes 1998-2014
0014 %      Version: $Id: lpcpf2cc.m 5025 2014-08-22 17:07:24Z dmb $
0015 %
0016 %   VOICEBOX is a MATLAB toolbox for speech processing.
0017 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
0018 %
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 %   This program is free software; you can redistribute it and/or modify
0021 %   it under the terms of the GNU General Public License as published by
0022 %   the Free Software Foundation; either version 2 of the License, or
0023 %   (at your option) any later version.
0024 %
0025 %   This program is distributed in the hope that it will be useful,
0026 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 %   GNU General Public License for more details.
0029 %
0030 %   You can obtain a copy of the GNU General Public License from
0031 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0032 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0034 [nf,nq]=size(pf);
0035 if nargin<2 || ~numel(np) np=nq-1; end
0036 if nargin<3 || ~numel(f)
0037     cc=rsfft(log(pf.')).'/(2*nq-2);
0038     c0=cc(:,1)*0.5;
0039     cc(:,nq)=cc(:,nq)*0.5;
0040     if np>nq-1
0041         cc=[cc(:,2:nq) zeros(nf,np-nq+1)];
0042     else
0043         cc=cc(:,2:np+1);
0044     end
0045 else
0046     cc=0.5*(log(pf)/cos(2*pi*f(:)*(0:min(np,nq-1))));
0047     c0=cc(:,1);
0048     cc=cc(:,2:end);
0049     if np>nq-1
0050         cc(1,np)=0;
0051     end
0052 end
0053 
0054

Generated on Tue 10-Oct-2017 08:30:10 by m2html © 2003