Programmer Guide/Command Reference/EVAL/lpc: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
Compute the linear prediction coefficients using the autocorrelation method. This function implements an all-pole filter approximation of the acoustic tube modell of the vocal tract. The implementation is based on the book "Linear Prediction of Speech" (J.D. Markel & A.H. Gray, Springer 1976). | Compute the linear prediction coefficients using the autocorrelation method. This function implements an all-pole filter approximation of the acoustic tube modell of the vocal tract. The implementation is based on the book "Linear Prediction of Speech" (J.D. Markel & A.H. Gray, Springer 1976). | ||
;Usage:<code>lpc(<var>x</var>, <var>m</var>, <var>p</var> {, <var>type</var> {, <var>lfft</var>}})</code> | ;Usage:<code>lpc(<var>x</var>, <var>m</var>, <var>p</var> {, <var>type</var> {, <var>lfft</var>}})</code> | ||
:;<var>x</var>:the signal vector; this should be a speech signal without windowing function (because the hamming-window is applied to ''x'' by this | :;<var>x</var>:the signal vector; this should be a speech signal without windowing function (because the hamming-window is applied to ''x'' by this function) | ||
:;<var>m</var>:number of coefficients | :;<var>m</var>:number of coefficients | ||
::rule of thumb: ''m'' ~ samplingrate / 1000 * 1.25 | ::rule of thumb: ''m'' ~ samplingrate / 1000 * 1.25 | ||
:;<var>p</var>:differentiation factor; 0 | :;<var>p</var>:differentiation factor; 0 ≤ ''p'' ≤ 1 (default=0) | ||
:;<var>type</var>:output selector; 0 | :;<var>type</var>:output selector; 0 ≤ ''type'' ≤ 4 (default=0) | ||
:;<var>lfft</var>:the length of the fft to be used for the computation of the transfer function (amplitude spectrum) of the inverse filter; ''m+1'' < ''lfft'' | :;<var>lfft</var>:the length of the fft to be used for the computation of the transfer function (amplitude spectrum) of the inverse filter; ''m+1'' < ''lfft'' | ||
::note: if necessary, the value of ''lfft'' is automatically corrected to the next possible value | |||
;Description: | ;Description: | ||
# apply differentiation to signal ''x'' | |||
# apply hamming window to signal ''x'' | |||
# use the autocorelation method to compute the inverse filter coefficients ''ai'', the reflection coefficients ''rc'' and the error (or residual) energy ''alpha'' | |||
# convert coefficients to the selected result | |||
;Result:A vector ''y'' containing the result of the function. | ;Result:A vector ''y'' containing the result of the function. | ||
:{|class="einrahmen" | :{|class="einrahmen" | ||
Line 23: | Line 24: | ||
|- | |- | ||
|'''1''' | |'''1''' | ||
|<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M+1]=''ai[0..''m''] | |<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M+1]=''ai[0..''m'']</code> | ||
|''m''+2 | |''m''+2 | ||
|the error energy (''alpha'') and the ''m''+1 inverse filter coefficients ''ai'' | |the error energy (''alpha'') and the ''m''+1 inverse filter coefficients ''ai'' | ||
|- | |- | ||
|'''2''' | |'''2''' | ||
|<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M]=''rc[0..''m''-1] | |<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M]=''rc[0..''m''-1]</code> | ||
|''m''+1 | |''m''+1 | ||
|the error energy (''alpha'') and the ''m'' reflection coefficients ''rc'' | |the error energy (''alpha'') and the ''m'' reflection coefficients ''rc'' | ||
|- | |- | ||
|'''3''' | |'''3''' | ||
|<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M+1]=''ar[0..''m''] | |<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M+1]=''ar[0..''m'']</code> | ||
|''m''+2 | |''m''+2 | ||
|the error energy (''alpha'') and the ''m'' area coefficients ''ar''<BR>(''ar''[i] ~ area of section i) | |the error energy (''alpha'') and the ''m'' area coefficients ''ar''<BR>(''ar''[i] ~ area of section i) | ||
|- | |- | ||
|'''4''' | |'''4''' | ||
|<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M+1]=''lar[0..''m''] | |<code>''y''[0]=''alpha''</code><BR><code>''y''[1..M+1]=''lar[0..''m'']</code> | ||
|''m''+2 | |''m''+2 | ||
|the error energy (''alpha'') and the ''m'' log. area coefficients ''lar''<BR>(''lar''[i] ~ diameter of section i) | |the error energy (''alpha'') and the ''m'' log. area coefficients ''lar''<BR>(''lar''[i] ~ diameter of section i) | ||
|} | |} | ||
;See also: [[ | ;See also: [[../fft|fft]], [[../ifft|ifft]], [[../dft|dft]], [[../dct|dct]], [[../cepstrum|cepstrum]] | ||
[[../#Functions|<function list>]] |
Latest revision as of 09:11, 2 May 2018
Compute the linear prediction coefficients using the autocorrelation method. This function implements an all-pole filter approximation of the acoustic tube modell of the vocal tract. The implementation is based on the book "Linear Prediction of Speech" (J.D. Markel & A.H. Gray, Springer 1976).
- Usage
lpc(x, m, p {, type {, lfft}})
- x
- the signal vector; this should be a speech signal without windowing function (because the hamming-window is applied to x by this function)
- m
- number of coefficients
- rule of thumb: m ~ samplingrate / 1000 * 1.25
- p
- differentiation factor; 0 ≤ p ≤ 1 (default=0)
- type
- output selector; 0 ≤ type ≤ 4 (default=0)
- lfft
- the length of the fft to be used for the computation of the transfer function (amplitude spectrum) of the inverse filter; m+1 < lfft
- note: if necessary, the value of lfft is automatically corrected to the next possible value
- Description
- apply differentiation to signal x
- apply hamming window to signal x
- use the autocorelation method to compute the inverse filter coefficients ai, the reflection coefficients rc and the error (or residual) energy alpha
- convert coefficients to the selected result
- Result
- A vector y containing the result of the function.
type y nrow(y) description 0 amplitude spectrum of the inverse filter lfft/2+1 this function can be used in speech analysis to compute the transfer function of the vocal tract (e.g. for formant extraction) 1 y[0]=alpha
y[1..M+1]=ai[0..m]
m+2 the error energy (alpha) and the m+1 inverse filter coefficients ai 2 y[0]=alpha
y[1..M]=rc[0..m-1]
m+1 the error energy (alpha) and the m reflection coefficients rc 3 y[0]=alpha
y[1..M+1]=ar[0..m]
m+2 the error energy (alpha) and the m area coefficients ar
(ar[i] ~ area of section i)4 y[0]=alpha
y[1..M+1]=lar[0..m]
m+2 the error energy (alpha) and the m log. area coefficients lar
(lar[i] ~ diameter of section i)