Home > voicebox > lpcconv.m

lpcconv

PURPOSE ^

LPCCONV(from,to,x,y)->s convert between LPC parameter sets

SYNOPSIS ^

function s=lpcconv(from,to,x,y,np)

DESCRIPTION ^

LPCCONV(from,to,x,y)->s convert between LPC parameter sets

 The output is a string that may be passed to eval(s)
 x and y are optionally the input and output matrices
 and np the new value of the order p.
 with one frame stored per row. from and to are taken
 from the following list which also gives the column dimension:

  1 ar p+1  Autoregressive coevfficients: ar(1)=1 always.
  2 cc  p   Complex cepstral coefficients
  3 ls  p   Line spectrum pair frequencies (normalized Hz)
  4 zz  p   Z-plane roots
  5 ss  p   S-plane roots (normalized Hz)
  6 rf  p   Reflection coefficients (= -PARCOR coefs)
  7 ao  p   Area ratios
  8 aa p+2  Vocal tract areas: aa(p+2)=1 always
  9 rr p+1  Autocorrelation coefficients
 10 dl  p   DCT of log area function
 11 lo  p   Log area ratios
 12 la p+1  Log areas: la(1)=0 always
 13 ra p+1  Autocorrelation coefs of inverse filter
 14 ff p+2  Fourier transform of forward filter (all-pole)
 15 pf p+2  Power spectrum of forward filter (all-pole)
 16 gc  p   Gain and cos(w) of each formant
 17 im p+1  Impulse response of forward filter

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function s=lpcconv(from,to,x,y,np)
0002 %LPCCONV(from,to,x,y)->s convert between LPC parameter sets
0003 %
0004 % The output is a string that may be passed to eval(s)
0005 % x and y are optionally the input and output matrices
0006 % and np the new value of the order p.
0007 % with one frame stored per row. from and to are taken
0008 % from the following list which also gives the column dimension:
0009 %
0010 %  1 ar p+1  Autoregressive coevfficients: ar(1)=1 always.
0011 %  2 cc  p   Complex cepstral coefficients
0012 %  3 ls  p   Line spectrum pair frequencies (normalized Hz)
0013 %  4 zz  p   Z-plane roots
0014 %  5 ss  p   S-plane roots (normalized Hz)
0015 %  6 rf  p   Reflection coefficients (= -PARCOR coefs)
0016 %  7 ao  p   Area ratios
0017 %  8 aa p+2  Vocal tract areas: aa(p+2)=1 always
0018 %  9 rr p+1  Autocorrelation coefficients
0019 % 10 dl  p   DCT of log area function
0020 % 11 lo  p   Log area ratios
0021 % 12 la p+1  Log areas: la(1)=0 always
0022 % 13 ra p+1  Autocorrelation coefs of inverse filter
0023 % 14 ff p+2  Fourier transform of forward filter (all-pole)
0024 % 15 pf p+2  Power spectrum of forward filter (all-pole)
0025 % 16 gc  p   Gain and cos(w) of each formant
0026 % 17 im p+1  Impulse response of forward filter
0027 
0028 %       Copyright (C) Mike Brookes 1998
0029 %      Version: $Id: lpcconv.m 713 2011-10-16 14:45:43Z dmb $
0030 %
0031 %   VOICEBOX is a MATLAB toolbox for speech processing.
0032 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
0033 %
0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035 %   This program is free software; you can redistribute it and/or modify
0036 %   it under the terms of the GNU General Public License as published by
0037 %   the Free Software Foundation; either version 2 of the License, or
0038 %   (at your option) any later version.
0039 %
0040 %   This program is distributed in the hope that it will be useful,
0041 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0042 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0043 %   GNU General Public License for more details.
0044 %
0045 %   You can obtain a copy of the GNU General Public License from
0046 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0047 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0049 
0050 nm=['aa';'am';'ao';'ar';'cc';'db';'dl';'ff';'fq';'im';'is';'la';'lo';'ls';'pf';'ra';'rf';'rr';'ss';'zz';];
0051 nx=[...
0052       0 17  3 17 17 17  7 17  0 17 17 17 17 17 17 17 17 17 17 17;...
0053       0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0;...
0054      17 17  0 17 17 17 17 17  0 17 17 17 17 17 17 17 17 17 17 17;...
0055      17 18 17  0  5  6 17  8  0 10 17 17 17 14 15 16 17 18 20 20;...
0056       4  4  4  4  5  6  4  4  0  4  4  4  4  4 15  4  4  4  4  4;...
0057      15 15 15 15 15  0 15 15  0 15 15 15 15 15 15 15 15 15 15 15;...
0058       1  1  1  1  1  1  0  1  0  1  1  1  1  1  1  1  1  1  1  1;...
0059      15 15 15 15 15 15 15  0  0 15 15 15 15 15 15 15 15 15 15 15;...
0060      20 20 20 20 20 20 20 20  0 20 20 20 20 20 20 20 20 20 20 20;...
0061       4  4  4  4  4  4  4  4  0  0  4  4  4  4  4  4  4  4  4  4;...
0062      17 17 17 17 17 17 17 17  0 17  0 17 17 17 17 17 17 17 17 17;...
0063      17 17 17 17 17 17 17 17  0 17 17  0 17 17 17 17 17 17 17 17;...
0064      17 17 17 17 17 17 17 17  0 17 17 17  0 17 17 17 17 17 17 17;...
0065       4  4  4  4  4  4  4  4  0  4  4  4  4  0  4  4  4  4  4  4;...
0066       5 18  5  5  5  5  5  5  0  5  5  5  5  5  0  5  5 18  5  5;...
0067      15 15 15 15 15 15 15 15  0 15 15 15 15 15 15  0 15 15 15 15;...
0068       1 18  3  4  4  4  1  4  0  4 11 12 13  4  4  4  0 18  4  4;...
0069       4  2  4  4  4  4  4  4  0  4  4  4  4  4  4  4  4  0  4  4;...
0070      20 20 20 20 20 20 20 20  0 20 20 20 20 20 20 20 20 20  0 20;...
0071       4  4  4  4  5  4  4  4  0  4  4  4  4  4  4  4  4  4 19  0;...
0072 ];
0073 na=size(nm,1);
0074 b=256*nm(:,1)+nm(:,2);
0075 jf=find(b==256*from(1)+from(2));
0076 jt=find(b==256*to(1)+to(2));
0077 if length([jf jt])~=2
0078    [x,idx]=sort(b);
0079   error(sprintf('lpcxx2yy types are: %s',[nm(idx,:)';' '*ones(1,na)]));
0080 end
0081 if nargin<3 s=nm(jf,:); else s=x; end
0082 while jf ~= jt
0083   jn=nx(jf,jt);
0084   if jn==0
0085      error(sprintf('cannot convert between %s and %s',nm(jf,:),nm(jt,:)));
0086  end
0087   s=sprintf('lpc%s2%s(%s)',nm(jf,:),nm(jn,:),s);
0088   jf=jn;
0089   end
0090 if nargin<4 sn=nm(jt,:); else sn=y; end
0091 s=sprintf('%s=%s;',sn,s);
0092     
0093 
0094

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