Programmer Guide/Command Reference/EVAL/cepstrum: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 4: Line 4:
;Usage 1:<code>cepstrum(<var>x</var>)</code>
;Usage 1:<code>cepstrum(<var>x</var>)</code>
:;<var>x</var>: a vector containing a log. amplitude spectrum
:;<var>x</var>: a vector containing a log. amplitude spectrum
:::*note: because the fft/ifft is used for the computation, the spectrum stored in ''x'' must be computed from a signal with <code>L=2^M</samples> (<code>-> nrow(''x'')=2^M/2+1</code>).
::*note: because the fft/ifft is used for the computation, the spectrum stored in ''x'' must be computed from a signal with <code>L=2^M</code> samples (<code>-> nrow(''x'')=L/2+1=2^M/2+1</code>).
;Result 1:The next (nearest) possible signal window length.  
;Result 1:A vector with <code>L/2</code> values, containing the coefficients or the real cepstrum of ''x''.  
----
----
;Usage 2:<code>fft(<var>x</var>)</code>
;Usage 2:<code>cepstrum(<var>x</var>, <var>m</var>)</code>
:;<var>x</var>: signal vector or matrix; if ''x'' is a matrix a spectrum of each column is computed
:;<var>x</var>: a vector containing a log. amplitude spectrum
;Result 2:A matrix ''y'' with [[../ncol|ncol(''x'')]] columns and L+2 rows, where each column ''y''[*,j] contains the complex spectrum of the column (channel) ''x''[*,j]. The transformation length L is set to [[../npow2|npow2(nrow(''x''))]].
:;<var>m</var>: the number of coefficients to be used for smoothing; 0 < ''m'' <= L/2
;Description:
:# The real cepstrum ''c'' of ''x'' is computed.  
:# The coefficents ''m'' to <code>L/2-1</code> of the cepstrum ''c'' are set to zero.
:# The smoothed spectrum is computed from the modified cepstrum ''c''.
;Result 2:A vector with same length as ''x'', containing the smoothed spectrum.  
----
----
;Usage 3:<code>fft(<var>x</var>, <var>n</var> {, <var>ytype</var>, <var>poffset</var>, <var>prange</var>, <var>aref</var>})</code>
;Usage 2:<code>cepstrum(<var>x</var>, <var>o</var>, <var>m</var>)</code>
:;<var>x</var>: signal vector or matrix; if ''x'' is a matrix a spectrum of each column is computed
:;<var>x</var>: a vector containing a log. amplitude spectrum
:;<var>n</var>: desired length of analysis window;
:;<var>o</var>: the first coefficient to be used for smoothing; 0 < ''o'' < L/2
::*If <code>''n'' < nrow(''x'')</code>, the analysis window length L is set to nrow(''x''), otherwise L is set to ''n''.
:;<var>m</var>: the number of coefficients to be used for smoothing; 0 < ''m'' <= L/2-''o''
::*If the analysis window length L is a power of 2 (L=2^M), the '''fft''' algorithm is used, otherwise the '''dft''' is used.
;Description:
::*If L is greater than [[../nrow|nrow(''x'')]], zero padding is applied to the signal.
:# The real cepstrum ''c'' of ''x'' is computed.  
:;<var>ytype</var>: select the type and format of the computed spectrum (default=0) -> see '''Result 3'''
:# The coefficents 0 to ''o''-1 and ''o''+''m'' to <code>L/2-1</code> of the cepstrum ''c'' are set to zero.
:;<var>poffset</var>: offset in samples to the signal begin or the selected ''zero phase'' position (default=0)
:# The liftered spectrum is computed from the modified cepstrum ''c''.
:::{|class="keinrahmen"
;Result 2:A vector with same length as ''x'', containing the liftered spectrum.
|''poffset''='''0''' ||-> <code>phase[i] = atan2(im[i], re[i])</code>
|-
|otherwise ||-> <code>phase[i] = (atan2(im[i], re[i]) - 2*pi*i/L * ''poffset'') % (2 * pi)</code>
|}
:;<var>prange</var>: selects the range of phase values (default=0)
:::{|class="keinrahmen"
|''prange''='''0''' ||-> <code>0 <= phase[i] < 2*pi</code>
|-
|otherwise ||-> <code>-pi <= phase[i] < pi</code>
|}
:;<var>aref</var>: reference amplitude if the log. spectrum (''ytype''=4) is requested (default=1)
;Result 3: A matrix ''y'' with [[../ncol|ncol(''x'')]] columns, where each column ''y''[*,j] contains the spectrum of the column (channel) ''x''[*,j]. The type and the length of the spectra is selected by the argument ''ytype''.
::{|class="einrahmen"
!''ytype'' !! description !! content of ''y''[*,j] !! nrow(''y'')
|-
|'''0'''
|complex spectrum in cartesian format
|<code>{ re<sub>0</sub>, im<sub>0</sub>, re<sub>1</sub>, im<sub>1</sub>, ... }</code>
|L+2
|-
|'''1'''
|complex spectrum in polar format
|<code>{ amp<sub>0</sub>, phase<sub>0</sub>, amp<sub>1</sub>, phase<sub>1</sub>, ... }<BR>with: amp<sub>i</sub>=sqrt(re<sub>i</sub><sup>2</sup> + im<sub>i</sub><sup>2</sup>),<BR>phase<sub>i</sub> see ''poffset''</code>
|L+2
|-
|'''2'''
|amplitude spectrum
|<code>{ amp<sub>0</sub>, amp<sub>1</sub>, ... }</code>
|L+1
|-
|'''3'''
|power spectrum
|<code>{ amp<sub>0</sub><sup>2</sup>, amp<sub>1</sub><sup>2</sup>, ... }</code>
| L+1
|-
|'''4'''  
|logarithmic amplitude spectrum
|<code>{ lev<sub>0</sub>, lev<sub>1</sub>, ... }<BR>with: lev<sub>i</sub>=20*log<sub>10</sub>(amp<sub>i</sub>/''aref'')</code>
| L+1
|}
----
----
;See also: [[Programmer_Guide/Command_Reference/EVAL/ifft|ifft]], [[Programmer_Guide/Command_Reference/EVAL/dft|dft]], [[Programmer_Guide/Command_Reference/EVAL/dct|dct]], [[Programmer_Guide/Command_Reference/EVAL/cepstrum|cepstrum]], [[Programmer_Guide/Command_Reference/EVAL/lpc|lpc]], [[Programmer_Guide/Command_Reference/EVAL/complex arithmetic|complex arithmetic]]
;See also: [[Programmer_Guide/Command_Reference/EVAL/ifft|ifft]], [[Programmer_Guide/Command_Reference/EVAL/dft|dft]], [[Programmer_Guide/Command_Reference/EVAL/dct|dct]], [[Programmer_Guide/Command_Reference/EVAL/cepstrum|cepstrum]], [[Programmer_Guide/Command_Reference/EVAL/lpc|lpc]], [[Programmer_Guide/Command_Reference/EVAL/complex arithmetic|complex arithmetic]]


[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====cepstrum=====
Cepstrum.
=====Usage:=====
<code>cepstrum(<var>x</var>)</code>
=====Function:=====
Computes the real cepstrum of <var>x</var>.
=====Result:=====
A vector containing the cepstrum coefficients.
=====Usage:=====
<code>cepstrum(<var>x</var>, <var>n</var>)</code>
=====Function:=====
Computes the cepstrum smoothed spectrum of <var>x</var> using the first <var>n</var> coefficients.
=====Result:=====
The cepstrum smoothed spectrum. This is the same type as <var>x</var>.
=====Usage:=====
<code>cepstrum(<var>x</var>, <var>o</var>, <var>n</var>)</code>
=====Function:=====
Computes the cepstrum smoothed spectrum of <var>x</var> using the coefficients o to <var>o</var><code>+</code><var>n</var><code>-1</code>.
=====Result:=====
The cepstrum smoothed spectrum. This is the same type as <var>x</var>.
=====Notes:=====
<var>x</var> must be a log. amplitude spectrum computed with a radix-2 fft.

Revision as of 13:35, 12 April 2011

Compute the real cepstrum or the cepstrum smoothed/liftered spectrum of the logarithmic spectrum x.


Usage 1
cepstrum(x)
x
a vector containing a log. amplitude spectrum
  • note: because the fft/ifft is used for the computation, the spectrum stored in x must be computed from a signal with L=2^M samples (-> nrow(x)=L/2+1=2^M/2+1).
Result 1
A vector with L/2 values, containing the coefficients or the real cepstrum of x.

Usage 2
cepstrum(x, m)
x
a vector containing a log. amplitude spectrum
m
the number of coefficients to be used for smoothing; 0 < m <= L/2
Description
  1. The real cepstrum c of x is computed.
  2. The coefficents m to L/2-1 of the cepstrum c are set to zero.
  3. The smoothed spectrum is computed from the modified cepstrum c.
Result 2
A vector with same length as x, containing the smoothed spectrum.

Usage 2
cepstrum(x, o, m)
x
a vector containing a log. amplitude spectrum
o
the first coefficient to be used for smoothing; 0 < o < L/2
m
the number of coefficients to be used for smoothing; 0 < m <= L/2-o
Description
  1. The real cepstrum c of x is computed.
  2. The coefficents 0 to o-1 and o+m to L/2-1 of the cepstrum c are set to zero.
  3. The liftered spectrum is computed from the modified cepstrum c.
Result 2
A vector with same length as x, containing the liftered spectrum.

See also
ifft, dft, dct, cepstrum, lpc, complex arithmetic

<function list>

Navigation menu

Personal tools