V_CCWARPF Warp cepstral coefficients M=(F,N,S) f(1) is the original sample freq, f(2) is the new sample freq n(1) is the original number of coefficients, n(2) is the new number s is a string: s(1),s(2) =l for linear, m for mel frequency, use capitals if c0 included
0001 function m=v_ccwarpf(f,n,s) 0002 %V_CCWARPF Warp cepstral coefficients M=(F,N,S) 0003 % f(1) is the original sample freq, f(2) is the new sample freq 0004 % n(1) is the original number of coefficients, n(2) is the new number 0005 % s is a string: s(1),s(2) =l for linear, m for mel frequency, use capitals if c0 included 0006 0007 0008 % Copyright (C) Mike Brookes 1998 0009 % Version: $Id: v_ccwarpf.m 10865 2018-09-21 17:22:45Z dmb $ 0010 % 0011 % VOICEBOX is a MATLAB toolbox for speech processing. 0012 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0013 % 0014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0015 % This program is free software; you can redistribute it and/or modify 0016 % it under the terms of the GNU General Public License as published by 0017 % the Free Software Foundation; either version 2 of the License, or 0018 % (at your option) any later version. 0019 % 0020 % This program is distributed in the hope that it will be useful, 0021 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0022 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0023 % GNU General Public License for more details. 0024 % 0025 % You can obtain a copy of the GNU General Public License from 0026 % http://www.gnu.org/copyleft/gpl.html or by writing to 0027 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 if nargin<3 0031 s='ll'; 0032 end 0033 if length(f)<2 0034 f(2)=1; 0035 end 0036 if length(n)<2 0037 n(2)=n(1); 0038 end 0039 z=s<'a'; 0040 s=s+32*z; 0041 if all(s=='l') 0042 k=1:n(2)-z(2); 0043 ff=((1:n(1)).'-z(1))*f(2)/f(1); 0044 fa=2*sin(ff*pi).*ff/pi; 0045 fb=ff.^2; 0046 ka=1-2*rem(k,2); 0047 kb=k.^2; 0048 r1=ones(n(1),1); 0049 c1=ones(1,n(2)-z(2)); 0050 a=fa(:,c1).*ka(r1,:); 0051 b=fb(:,c1)-kb(r1,:); 0052 f0=find(fix(ff)==ff); 0053 if length(f0) 0054 a(f0,:)=ff(f0,c1)==k(ones(length(f0),1),:); 0055 b(f0,:)=1; 0056 end 0057 m=a./b; 0058 if z(2) 0059 m=[[1; 0.5*fa(2:n(1))./fb(2:n(1))] m]; 0060 end 0061 end 0062 0063 0064