v_lpccc2db

PURPOSE ^

V_LPCCC2DB Convert complex cepstrum to dB power spectrum DB=(CC,NP,NC)

SYNOPSIS ^

function [db,f]=v_lpccc2db(cc,np,nc,c0)

DESCRIPTION ^

V_LPCCC2DB Convert complex cepstrum to dB power spectrum DB=(CC,NP,NC)

  Inputs: cc(nf,n)     Complex ceptral coefficients excluding c(0), one frame per row
          np           Size of output spectrum is np+1 [n]
                       Alternatively, np can be a vector of output frequencies in the range 0 to 0.5
          nc           Highest cepstral coefficient to use [np or, if np is a vector, n]
                       Set nc=-1 to use n coefficients
          c0(nf,1)     Cepstral coefficient cc(0) [0]

 Outputs: db(nf,np+2)  Power spectrum from DC to Nyquist in dB
          f(1,np+2)    Normalized frequencies (0 to 0.5)

 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.
 For highest speed, choose np to be a power of 2.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [db,f]=v_lpccc2db(cc,np,nc,c0)
0002 %V_LPCCC2DB Convert complex cepstrum to dB power spectrum DB=(CC,NP,NC)
0003 %
0004 %  Inputs: cc(nf,n)     Complex ceptral coefficients excluding c(0), one frame per row
0005 %          np           Size of output spectrum is np+1 [n]
0006 %                       Alternatively, np can be a vector of output frequencies in the range 0 to 0.5
0007 %          nc           Highest cepstral coefficient to use [np or, if np is a vector, n]
0008 %                       Set nc=-1 to use n coefficients
0009 %          c0(nf,1)     Cepstral coefficient cc(0) [0]
0010 %
0011 % Outputs: db(nf,np+2)  Power spectrum from DC to Nyquist in dB
0012 %          f(1,np+2)    Normalized frequencies (0 to 0.5)
0013 %
0014 % The "complex cepstral coefficients", cc(n), are the inverse discrete-time Fourier transform
0015 % of the log of the complex-valued spectrum. The cc(n) are real-valued and, for n<0, cc(n)=0.
0016 % The "real cepstral coeffcients", rc(n), are the inverse discrete-time Fourier transform
0017 % of the log of the magnitude spectrum; rc(0)=cc(0) and rc(n)=0.5*cc(n) for n~=0.
0018 % For highest speed, choose np to be a power of 2.
0019 
0020 %      Copyright (C) Mike Brookes 1998-2014
0021 %      Version: $Id: v_lpccc2db.m 10865 2018-09-21 17:22:45Z dmb $
0022 %
0023 %   VOICEBOX is a MATLAB toolbox for speech processing.
0024 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
0025 %
0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0027 %   This program is free software; you can redistribute it and/or modify
0028 %   it under the terms of the GNU General Public License as published by
0029 %   the Free Software Foundation; either version 2 of the License, or
0030 %   (at your option) any later version.
0031 %
0032 %   This program is distributed in the hope that it will be useful,
0033 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0034 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0035 %   GNU General Public License for more details.
0036 %
0037 %   You can obtain a copy of the GNU General Public License from
0038 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0039 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0041 [nf,mc]=size(cc);
0042 if nargin<2 || ~numel(np)
0043     if nargout
0044         np=mc;
0045     else
0046         np=128;
0047     end
0048 end
0049 k=10/log(10);
0050 if nargin>=3 && numel(nc)==1 && nc==-1 nc=mc; end
0051 if nargin<4 || ~numel(c0) c0=zeros(nf,1); end
0052 if numel(np)>1 || np(1)<1
0053     if nargin<3 || ~numel(nc) nc=mc; end
0054     f=np(:)';
0055     if nc==mc
0056         db=k*(2*[c0 cc]*cos(2*pi*(0:mc)'*f));
0057     else
0058         db=k*(2*[c0 lpccc2cc(cc,nc)]*cos(2*pi*(0:nc)'*f));
0059     end
0060 else
0061     if nargin<3 || ~numel(nc) nc=np; end
0062     if nc==mc
0063         db=k*(2*real(v_rfft([c0 cc].',2*np).'));
0064     else
0065         db=k*(2*real(v_rfft([c0 v_lpccc2cc(cc,nc)].',2*np).'));
0066     end
0067     f=linspace(0,0.5,np+1);
0068 end
0069 if ~nargout
0070     plot(f,db.');
0071     xlabel('Normalized frequency f/f_s');
0072     ylabel('Gain (dB)');
0073 end
0074 
0075 
0076 
0077 
0078

Generated by m2html © 2003