LPCPF2FF Convert power spectrum to complex spectrum [FF,FO]=(PF,NP,FI) Inputs: pf(nf,n) Power spectrum at n discrete frequencies, one frame per row np Number of complex cepstral coefficients to use (excluding c0) [n-1] should be greater than the sum of the numerator and denominator filter orders but less than n fi(1,n) Vector of frequencies [linspace(0,0.5,n)] including this argument slows down the routine Outputs: ff(nf,n) Complex spectrum (pf = abs(ff).^2 fo(1,n) Vector of frequencies This routine converts a power spectrum into the corresponding complex spectrum. It determines the phase spectrum under the assumption that it is minimum phase. The routine works by converting first to the compex cepstrum.

- lpccc2ff LPCCC2FF Convert complex cepstrum to complex spectrum FF=(CC,NP,NC)
- lpcpf2cc LPCPF2CC Convert power spectrum to complex cepstrum CC=(PF,NP)

0001 function [ff,fo]=lpcpf2ff(pf,np,fi) 0002 %LPCPF2FF Convert power spectrum to complex spectrum [FF,FO]=(PF,NP,FI) 0003 % 0004 % Inputs: pf(nf,n) Power spectrum at n discrete frequencies, one frame per row 0005 % np Number of complex cepstral coefficients to use (excluding c0) [n-1] 0006 % should be greater than the sum of the numerator 0007 % and denominator filter orders but less than n 0008 % fi(1,n) Vector of frequencies [linspace(0,0.5,n)] 0009 % including this argument slows down the routine 0010 % 0011 % Outputs: ff(nf,n) Complex spectrum (pf = abs(ff).^2 0012 % fo(1,n) Vector of frequencies 0013 % 0014 % This routine converts a power spectrum into the corresponding complex 0015 % spectrum. It determines the phase spectrum under the assumption that it 0016 % is minimum phase. The routine works by converting first to the compex 0017 % cepstrum. 0018 0019 % Copyright (C) Mike Brookes 2014 0020 % Version: $Id: lpcpf2ff.m 5026 2014-08-22 17:47:43Z dmb $ 0021 % 0022 % VOICEBOX is a MATLAB toolbox for speech processing. 0023 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 % This program is free software; you can redistribute it and/or modify 0027 % it under the terms of the GNU General Public License as published by 0028 % the Free Software Foundation; either version 2 of the License, or 0029 % (at your option) any later version. 0030 % 0031 % This program is distributed in the hope that it will be useful, 0032 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0033 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0034 % GNU General Public License for more details. 0035 % 0036 % You can obtain a copy of the GNU General Public License from 0037 % http://www.gnu.org/copyleft/gpl.html or by writing to 0038 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 [nf,nq]=size(pf); 0041 if nargin<3 fi=[]; 0042 if nargin<2 0043 np=nq-1; % number of cepstal coefficients (excl c(0)) 0044 end 0045 end 0046 [cc,c0]=lpcpf2cc(pf,np,fi); 0047 if ~numel(fi) 0048 fi=nq-1; 0049 end 0050 [fx,fo]=lpccc2ff(cc,fi,-1,c0); 0051 ff=sqrt(pf).*exp(1i*angle(fx)); 0052 if ~nargout 0053 subplot(2,1,2); 0054 plot(fo,unwrap(angle(ff.'))); 0055 xlabel('Normalized frequency f/f_s'); 0056 ylabel('Phase (rad)'); 0057 subplot(2,1,1); 0058 plot(fo,db(abs(ff.')),'-b',fo,db(pf.')/2,':k'); 0059 xlabel('Normalized frequency f/f_s'); 0060 ylabel('Gain (dB)'); 0061 end 0062 0063

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