Home > voicebox > cep2pow.m

# cep2pow

## PURPOSE

CEP2POW convert cepstral means and variances to the power domain

## SYNOPSIS

function [m,c]=cep2pow(u,v,mode)

## DESCRIPTION

CEP2POW convert cepstral means and variances to the power domain
Inputs:
u: vector giving the cepstral means with u(1) the 0'th cepstral coefficient
v: cepstral covariance matrix or else a vector containing the diagonal elements
mode: 'c'  pow=exp(irdct(cep))    [default]
'f'  pow=exp(rsfft(cep)/n)  [fft length even]
'fo' pow=exp(rsfft(cep)/n)  [fft length odd]
'i'  pow=exp(cep)           [ no transformation ]

Outputs:
m: row vector giving means in the power domain
c: covariance matrix in the power domain

## CROSS-REFERENCE INFORMATION

This function calls:
• irdct IRDCT Inverse discrete cosine transform of real data X=(Y,N)
• rsfft RSFFT fft of a real symmetric spectrum X=(Y,N)
This function is called by:

## SOURCE CODE

0001 function [m,c]=cep2pow(u,v,mode)
0002 %CEP2POW convert cepstral means and variances to the power domain
0003 % Inputs:
0004 %    u: vector giving the cepstral means with u(1) the 0'th cepstral coefficient
0005 %    v: cepstral covariance matrix or else a vector containing the diagonal elements
0006 % mode: 'c'  pow=exp(irdct(cep))    [default]
0007 %       'f'  pow=exp(rsfft(cep)/n)  [fft length even]
0008 %       'fo' pow=exp(rsfft(cep)/n)  [fft length odd]
0009 %       'i'  pow=exp(cep)           [ no transformation ]
0010 %
0011 % Outputs:
0012 %    m: row vector giving means in the power domain
0013 %    c: covariance matrix in the power domain
0014
0015 %      Copyright (C) Mike Brookes 1998
0016 %      Version: \$Id: cep2pow.m 713 2011-10-16 14:45:43Z dmb \$
0017 %
0018 %   VOICEBOX is a MATLAB toolbox for speech processing.
0020 %
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 %   This program is free software; you can redistribute it and/or modify
0023 %   it under the terms of the GNU General Public License as published by
0024 %   the Free Software Foundation; either version 2 of the License, or
0025 %   (at your option) any later version.
0026 %
0027 %   This program is distributed in the hope that it will be useful,
0028 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0029 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0030 %   GNU General Public License for more details.
0031 %
0032 %   You can obtain a copy of the GNU General Public License from
0033 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0034 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036
0037 if nargin<3 mode='c'; end
0038 if min(size(v))==1
0039    v=diag(v);
0040 end
0041 u=u(:)';    % force u to be a row vector
0042 if any(mode=='f')
0043    n=2*length(u)-2;
0044    if any(mode=='o')
0045       n=n+1;
0046    end
0047    p=rsfft(u',n)/n;
0048    q=rsfft(rsfft(v,n)',n)/n^2;
0049 elseif any(mode=='i')
0050     p=u';
0051     q=v';
0052 else
0053    p=irdct(u');
0054    q=irdct(irdct(v)');
0055 end
0056 m=exp(p+0.5*diag(q))';
0057 c=(m'*m).*(exp(q)-1);

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