LPC Analysis of Speech¶
Autocorrelation and covariance LPC, bandwidth expansion, inverse filtering, stability enforcement, and a complete set of conversions between LPC representations (AR, reflection coefficients, line spectra, cepstra, impulse response, power spectrum, poles and zeros, etc.).
Core LPC analysis¶
v_lpcauto
¶
V_LPCAUTO - Perform autocorrelation LPC analysis.
v_lpcauto
¶
Perform autocorrelation LPC analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
(array_like, shape(ns) or (ns, nch))
|
Input signal. |
required |
p
|
int
|
LPC order. Default is 12. |
12
|
t
|
array_like
|
Frame size details [hop, anal, skip]. Default is entire signal. |
None
|
w
|
str or array_like
|
Window type or window vector. Default is 'm' (Hamming). |
'm'
|
m
|
str
|
Mode options: 'e' normalize window, 'j' joint analysis. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1) or (nf, p + 1, nch))
|
AR coefficients with ar[:, 0] = 1. |
e |
(ndarray, shape(nf) or (nf, nch))
|
Residual energy. |
k |
(ndarray, shape(nf, 2))
|
First and last sample of analysis intervals (1-based). |
Source code in pyvoicebox/v_lpcauto.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
v_lpccovar
¶
V_LPCCOVAR - Perform covariance LPC analysis.
v_lpccovar
¶
Perform covariance LPC analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
(array_like, shape(ns))
|
Input signal. |
required |
p
|
int
|
LPC order. Default is 12. |
12
|
t
|
array_like
|
Frame specification. Default is [p+1, len(s)] (1-based). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1))
|
AR coefficients with ar[:, 0] = 1. |
e |
(ndarray, shape(nf, 4))
|
[Er, Es, Pr, Ps]: energy and power in residual and signal. |
dc |
(ndarray, shape(nf))
|
DC component (only meaningful if computed). |
Source code in pyvoicebox/v_lpccovar.py
v_lpcconv
¶
V_LPCCONV - Convert between LPC parameter sets (generates conversion string).
v_lpcconv
¶
Generate conversion path between LPC parameter sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
from_type
|
str
|
Source parameter type (2-char code). |
required |
to_type
|
str
|
Target parameter type (2-char code). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
path |
str
|
String describing the conversion path. |
Source code in pyvoicebox/v_lpcconv.py
v_lpcbwexp
¶
V_LPCBWEXP - Expand formant bandwidths of LPC filter.
v_lpcbwexp
¶
Expand formant bandwidths of LPC filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients. |
required |
bw
|
float
|
Bandwidth expansion factor. The radius of each pole is multiplied by exp(-bw*pi). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
arx |
(ndarray, shape(nf, p + 1))
|
Bandwidth-expanded AR coefficients. |
Source code in pyvoicebox/v_lpcbwexp.py
v_lpcstable
¶
V_LPCSTABLE - Test AR coefficients for stability and stabilize if necessary.
v_lpcstable
¶
Test AR coefficients for stability and stabilize if necessary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
m |
(ndarray, shape(nf))
|
Boolean mask identifying stable polynomials. |
a |
(ndarray, shape(nf, p + 1))
|
Stabilized polynomials with a[:, 0] = 1. |
Source code in pyvoicebox/v_lpcstable.py
v_lpcifilt
¶
V_LPCIFILT - Apply inverse filter to speech signal.
v_lpcifilt
¶
Apply inverse filter to speech signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
(array_like, shape(ns))
|
Speech signal. |
required |
ar
|
(array_like, shape(nf, p + 1))
|
AR coefficients, one row per frame. |
required |
t
|
(array_like, shape(nf))
|
Index of first sample in each frame (1-based as in MATLAB). |
None
|
dc
|
(array_like, shape(nf) or scalar)
|
DC component to subtract from signal. |
None
|
fade
|
float
|
Number of samples for linear interpolation at frame boundaries. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
u |
(ndarray, shape(ns))
|
Inverse filtered signal. |
Source code in pyvoicebox/v_lpcifilt.py
v_lpcrand
¶
V_LPCRAND - Generate random stable polynomials.
v_lpcrand
¶
Generate random stable polynomials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
int
|
Polynomial order. |
required |
n
|
int
|
Number of polynomials. Default is 1. |
1
|
bw
|
float or array_like
|
Minimum pole bandwidth as fraction of sampling frequency. Default is 0. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(n, p + 1))
|
Random stable AR polynomials. |
Source code in pyvoicebox/v_lpcrand.py
v_rootstab
¶
V_ROOTSTAB - Determine number of polynomial roots outside, inside and on the unit circle.
v_rootstab
¶
Determine number of polynomial roots outside, inside and on the unit circle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
array_like
|
Polynomial with real or complex coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
no |
int
|
Number of roots outside the unit circle. |
ni |
int
|
Number of roots inside the unit circle. |
nc |
int
|
Number of roots lying on the unit circle. |
Source code in pyvoicebox/v_rootstab.py
v_ccwarpf
¶
V_CCWARPF - Warp cepstral coefficients.
v_ccwarpf
¶
Warp cepstral coefficients for frequency/representation changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
array_like
|
[original_fs, new_fs]. If scalar, new_fs=1. |
required |
n
|
array_like
|
[original_n, new_n]. If scalar, new_n=original_n. |
required |
s
|
str
|
Two characters: s[0],s[1] = 'l' for linear, 'm' for mel frequency. Uppercase if c0 is included. |
'll'
|
Returns:
| Name | Type | Description |
|---|---|---|
m |
ndarray
|
Warping matrix. |
Source code in pyvoicebox/v_ccwarpf.py
AR coefficient conversions¶
v_lpcar2am
¶
V_LPCAR2AM - Convert AR coefficients to AR coefficient matrix.
v_lpcar2am
¶
Convert AR coefficients to AR coefficient matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p0 + 1))
|
Autoregressive coefficients. |
required |
p
|
int
|
Output order. Default is p0. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
am |
(ndarray, shape(p + 1, p + 1, nf))
|
AR coefficient matrix (upper triangular with 1s on diagonal). |
em |
(ndarray, shape(nf, p + 1))
|
Residual energy for each order. |
Source code in pyvoicebox/v_lpcar2am.py
v_lpcar2cc
¶
V_LPCAR2CC - Convert AR filter to complex cepstrum.
v_lpcar2cc
¶
Convert AR filter to complex cepstrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, n + 1))
|
AR coefficients, one frame per row. |
required |
np_out
|
int
|
Number of cepstral coefficients to calculate. Default is n. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
cc |
(ndarray, shape(nf, np_out))
|
Complex cepstral coefficients, excluding c(0). |
c0 |
(ndarray, shape(nf, 1))
|
Coefficient c(0). |
Source code in pyvoicebox/v_lpcar2cc.py
v_lpcar2db
¶
V_LPCAR2DB - Convert AR coefficients to power spectrum in dB.
v_lpcar2db
¶
Convert AR coefficients to power spectrum in dB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, n))
|
AR coefficients, one frame per row. |
required |
np_out
|
int
|
Size of output spectrum is np_out+1. Default is n-1. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
db |
(ndarray, shape(nf, np_out + 1))
|
Power spectrum in dB from DC to Nyquist. |
f |
(ndarray, shape(np_out + 1))
|
Normalized frequencies (0 to 0.5). |
Source code in pyvoicebox/v_lpcar2db.py
v_lpcar2ff
¶
V_LPCAR2FF - Convert AR coefficients to complex spectrum.
v_lpcar2ff
¶
Convert AR coefficients to complex spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, n))
|
AR coefficients, one frame per row. |
required |
np_out
|
int
|
Size of output spectrum is np_out+1. Default is n-1. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ff |
(ndarray, shape(nf, np_out + 1))
|
Complex spectrum from DC to Nyquist. |
f |
(ndarray, shape(np_out + 1))
|
Normalized frequencies (0 to 0.5). |
Source code in pyvoicebox/v_lpcar2ff.py
v_lpcar2fm
¶
V_LPCAR2FM - Convert autoregressive coefficients to formant freq+amp+bw.
v_lpcar2fm
¶
Convert autoregressive coefficients to formant frequencies, amplitudes and bandwidths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients. |
required |
t
|
float
|
Threshold. If t>0, poles with bandwidth > t*frequency are ignored. If t<=0, poles with bandwidth > -t are ignored. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
n |
(ndarray, shape(nf))
|
Number of formants found per frame. |
f |
(ndarray, shape(nf, m))
|
Formant frequencies in normalized Hz. |
a |
(ndarray, shape(nf, m))
|
Formant amplitudes. |
b |
(ndarray, shape(nf, m))
|
Formant bandwidths in normalized Hz. |
Source code in pyvoicebox/v_lpcar2fm.py
v_lpcar2im
¶
V_LPCAR2IM - Convert AR coefficients to impulse response.
v_lpcar2im
¶
Convert AR coefficients to impulse response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
AR coefficients, one frame per row. |
required |
np_out
|
int
|
Number of impulse response samples minus 1. Default is p. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
im |
(ndarray, shape(nf, np_out + 1))
|
Impulse response. |
Source code in pyvoicebox/v_lpcar2im.py
v_lpcar2ls
¶
V_LPCAR2LS - Convert AR polynomial to line spectrum pair frequencies.
v_lpcar2ls
¶
Convert AR polynomial to line spectrum pair frequencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ls |
(ndarray, shape(nf, p))
|
Line spectrum pair frequencies in normalized Hz (0 to 0.5). |
Source code in pyvoicebox/v_lpcar2ls.py
v_lpcar2pf
¶
V_LPCAR2PF - Convert AR coefficients to power spectrum.
v_lpcar2pf
¶
Convert AR coefficients to power spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, n))
|
AR coefficients, one frame per row. |
required |
np_out
|
int
|
Size of output spectrum is np_out+1. Default is n-1. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
pf |
(ndarray, shape(nf, np_out + 1))
|
Power spectrum from DC to Nyquist. |
f |
(ndarray, shape(np_out + 1))
|
Normalized frequencies (0 to 0.5). |
Source code in pyvoicebox/v_lpcar2pf.py
v_lpcar2pp
¶
V_LPCAR2PP - Convert AR filter to power spectrum polynomial in cos(w).
v_lpcar2pp
¶
Convert AR filter to power spectrum polynomial in cos(w).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
pp |
(ndarray, shape(nf, p + 1))
|
Power spectrum polynomial coefficients in cos(w). |
Source code in pyvoicebox/v_lpcar2pp.py
v_lpcar2ra
¶
V_LPCAR2RA - Convert AR filter to inverse filter autocorrelation coefficients.
v_lpcar2ra
¶
Convert AR filter to inverse filter autocorrelation coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ra |
(ndarray, shape(nf, p + 1))
|
Inverse filter autocorrelation coefficients. |
Source code in pyvoicebox/v_lpcar2ra.py
v_lpcar2rf
¶
V_LPCAR2RF - Convert autoregressive coefficients to reflection coefficients.
v_lpcar2rf
¶
Convert autoregressive coefficients to reflection coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients with ar[:, 0] = 1. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rf |
(ndarray, shape(nf, p + 1))
|
Reflection coefficients with rf[:, 0] = 1. |
Source code in pyvoicebox/v_lpcar2rf.py
v_lpcar2rr
¶
V_LPCAR2RR - Convert autoregressive coefficients to autocorrelation coefficients.
v_lpcar2rr
¶
Convert autoregressive coefficients to autocorrelation coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, n + 1))
|
Autoregressive coefficients including 0th coefficient. |
required |
p
|
int
|
Number of output coefficients. Default is n. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
rr |
(ndarray, shape(nf, p + 1))
|
Autocorrelation coefficients including 0th order coefficient. |
Source code in pyvoicebox/v_lpcar2rr.py
v_lpcar2zz
¶
V_LPCAR2ZZ - Convert AR filter to z-plane poles.
v_lpcar2zz
¶
Convert AR filter to z-plane poles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ar
|
(array_like, shape(nf, p + 1))
|
Autoregressive coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
zz |
(ndarray, shape(nf, p))
|
Z-plane poles. |
Source code in pyvoicebox/v_lpcar2zz.py
Reflection coefficient conversions¶
v_lpcrf2aa
¶
V_LPCRF2AA - Convert reflection coefficients to area function.
v_lpcrf2aa
¶
Convert reflection coefficients to area function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rf
|
(array_like, shape(nf, p + 1))
|
Reflection coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
aa |
(ndarray, shape(nf, p + 2))
|
Area function, normalized so aa[:, -1] = 1. |
Source code in pyvoicebox/v_lpcrf2aa.py
v_lpcrf2ao
¶
V_LPCRF2AO - Convert reflection coefficients to area ratios.
v_lpcrf2ao
¶
Convert reflection coefficients to area ratios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rf
|
array_like
|
Reflection coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ao |
ndarray
|
Area ratios. |
Source code in pyvoicebox/v_lpcrf2ao.py
v_lpcrf2ar
¶
V_LPCRF2AR - Convert reflection coefficients to autoregressive coefficients.
v_lpcrf2ar
¶
Convert reflection coefficients to autoregressive coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rf
|
(array_like, shape(nf, p + 1))
|
Reflection coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1))
|
Autoregressive coefficients with ar[:, 0] = 1. |
Source code in pyvoicebox/v_lpcrf2ar.py
v_lpcrf2is
¶
V_LPCRF2IS - Convert reflection coefficients to inverse sines.
v_lpcrf2is
¶
Convert reflection coefficients to inverse sines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rf
|
array_like
|
Reflection coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
is_coef |
ndarray
|
Inverse sine coefficients. |
Source code in pyvoicebox/v_lpcrf2is.py
v_lpcrf2la
¶
V_LPCRF2LA - Convert reflection coefficients to log areas.
v_lpcrf2la
¶
Convert reflection coefficients to log areas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rf
|
(array_like, shape(nf, p + 1))
|
Reflection coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
la |
(ndarray, shape(nf, p + 2))
|
Log areas, normalized so la[:, -1] = 0. |
Source code in pyvoicebox/v_lpcrf2la.py
v_lpcrf2lo
¶
V_LPCRF2LO - Convert reflection coefficients to log area ratios.
v_lpcrf2lo
¶
Convert reflection coefficients to log area ratios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rf
|
array_like
|
Reflection coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
lo |
ndarray
|
Log area ratios (limited to about +-14.5). |
Source code in pyvoicebox/v_lpcrf2lo.py
v_lpcrf2rr
¶
V_LPCRF2RR - Convert reflection coefficients to autocorrelation coefficients.
v_lpcrf2rr
¶
Convert reflection coefficients to autocorrelation coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rf
|
(array_like, shape(nf, n + 1))
|
Reflection coefficients, one row per frame. |
required |
p
|
int
|
Number of autocorrelation coefficients to calculate. Default is n. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
rr |
(ndarray, shape(nf, p + 1))
|
Autocorrelation coefficients. |
ar |
(ndarray, shape(nf, n + 1))
|
AR filter coefficients. |
Source code in pyvoicebox/v_lpcrf2rr.py
Cepstral coefficient conversions¶
v_lpccc2ar
¶
V_LPCCC2AR - Convert complex cepstrum to AR coefficients.
v_lpccc2ar
¶
Convert complex cepstrum to AR coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cc
|
(array_like, shape(nf, p))
|
Complex cepstral coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1))
|
Autoregressive coefficients. |
Source code in pyvoicebox/v_lpccc2ar.py
v_lpccc2cc
¶
V_LPCCC2CC - Extrapolate complex cepstrum.
v_lpccc2cc
¶
Extrapolate complex cepstrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cc
|
(array_like, shape(nf, p))
|
Complex cepstral coefficients. |
required |
np_out
|
int
|
Output number of coefficients. Default is p. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
c |
(ndarray, shape(nf, np_out))
|
Extrapolated complex cepstral coefficients. |
Source code in pyvoicebox/v_lpccc2cc.py
v_lpccc2db
¶
V_LPCCC2DB - Convert complex cepstrum to dB power spectrum.
v_lpccc2db
¶
Convert complex cepstrum to dB power spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cc
|
(array_like, shape(nf, n))
|
Complex cepstral coefficients excluding c(0). |
required |
np_out
|
int
|
Size of output spectrum is np_out+1. Default is n. |
None
|
nc
|
int
|
Highest cepstral coefficient to use. Set nc=-1 to use n coefficients. |
None
|
c0
|
(array_like, shape(nf, 1))
|
Cepstral coefficient c(0). Default is 0. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
db |
(ndarray, shape(nf, np_out + 1))
|
Power spectrum from DC to Nyquist in dB. |
f |
ndarray
|
Normalized frequencies (0 to 0.5). |
Source code in pyvoicebox/v_lpccc2db.py
v_lpccc2ff
¶
V_LPCCC2FF - Convert complex cepstrum to complex spectrum.
v_lpccc2ff
¶
Convert complex cepstrum to complex spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cc
|
(array_like, shape(nf, n))
|
Complex cepstral coefficients excluding c(0). |
required |
np_out
|
int
|
Size of output spectrum is np_out+1. Default is n. |
None
|
nc
|
int
|
Number of cepstral coefficients to use. Set nc=-1 to use n. |
None
|
c0
|
(array_like, shape(nf, 1))
|
Cepstral coefficient c(0). Default is 0. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ff |
(ndarray, shape(nf, np_out + 1))
|
Complex spectrum from DC to Nyquist. |
f |
ndarray
|
Normalized frequencies (0 to 0.5). |
Source code in pyvoicebox/v_lpccc2ff.py
v_lpccc2pf
¶
V_LPCCC2PF - Convert complex cepstrum to power spectrum.
v_lpccc2pf
¶
Convert complex cepstrum to power spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cc
|
(array_like, shape(nf, n))
|
Complex cepstral coefficients excluding c(0). |
required |
np_out
|
int
|
Size of output spectrum is np_out+1. Default is n. |
None
|
nc
|
int
|
Highest cepstral coefficient to use. Set nc=-1 to use n. |
None
|
c0
|
(array_like, shape(nf, 1))
|
Cepstral coefficient c(0). Default is 0. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
pf |
(ndarray, shape(nf, np_out + 1))
|
Power spectrum from DC to Nyquist. |
f |
ndarray
|
Normalized frequencies (0 to 0.5). |
Source code in pyvoicebox/v_lpccc2pf.py
Other conversions¶
v_lpcaa2ao
¶
V_LPCAA2AO - Convert area function to area ratios.
v_lpcaa2ao
¶
Convert area function to area ratios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aa
|
(array_like, shape(nf, p + 2))
|
Area function. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ao |
(ndarray, shape(nf, p + 1))
|
Area ratios. |
Source code in pyvoicebox/v_lpcaa2ao.py
v_lpcaa2dl
¶
V_LPCAA2DL - Convert area coefficients to DCT of log area.
v_lpcaa2dl
¶
Convert area coefficients to DCT of log area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aa
|
(array_like, shape(nf, p + 2))
|
Area coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dl |
(ndarray, shape(nf, p))
|
DCT of log area. |
Source code in pyvoicebox/v_lpcaa2dl.py
v_lpcaa2rf
¶
V_LPCAA2RF - Convert vocal tract areas to reflection coefficients.
v_lpcaa2rf
¶
Convert vocal tract areas to reflection coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aa
|
(array_like, shape(nf, p + 2))
|
Vocal tract areas. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rf |
(ndarray, shape(nf, p + 1))
|
Reflection coefficients. |
Source code in pyvoicebox/v_lpcaa2rf.py
v_lpcao2rf
¶
V_LPCAO2RF - Convert area ratios to reflection coefficients.
v_lpcao2rf
¶
Convert area ratios to reflection coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ao
|
array_like
|
Area ratios. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rf |
ndarray
|
Reflection coefficients. |
Source code in pyvoicebox/v_lpcao2rf.py
v_lpccw2zz
¶
V_LPCCW2ZZ - Power spectrum roots to LPC poles.
v_lpccw2zz
¶
Convert power spectrum cos(w) roots to LPC z-plane poles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cw
|
array_like
|
Roots of the power spectrum polynomial pp(cos(w)). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
zz |
ndarray
|
LPC z-plane poles. |
Source code in pyvoicebox/v_lpccw2zz.py
v_lpcdb2pf
¶
V_LPCDB2PF - Convert decibel power spectrum to power spectrum.
v_lpcdb2pf
¶
Convert decibel power spectrum to power spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db
|
array_like
|
Power spectrum in dB. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
pf |
ndarray
|
Power spectrum (linear scale). |
Source code in pyvoicebox/v_lpcdb2pf.py
v_lpcdl2aa
¶
V_LPCDL2AA - Convert DCT of log area to area coefficients.
v_lpcdl2aa
¶
Convert DCT of log area to area coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dl
|
(array_like, shape(nf, p))
|
DCT of log area. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
aa |
(ndarray, shape(nf, p + 2))
|
Area coefficients with aa[:, 0] = 0 and aa[:, -1] = 1. |
Source code in pyvoicebox/v_lpcdl2aa.py
v_lpcff2pf
¶
V_LPCFF2PF - Convert complex spectrum to power spectrum.
v_lpcff2pf
¶
Convert complex spectrum to power spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ff
|
array_like
|
Complex spectrum. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
pf |
ndarray
|
Power spectrum. |
Source code in pyvoicebox/v_lpcff2pf.py
v_lpcfq2zz
¶
V_LPCFQ2ZZ - Convert frequencies and Q factors to z-plane poles.
v_lpcfq2zz
¶
Convert frequencies and Q factors to z-plane poles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
(array_like, shape(nf, pf))
|
Frequencies in normalized Hz. |
required |
q
|
(array_like, shape(nf, pq))
|
Q factors. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
zz |
(ndarray, shape(nf, pf + pq))
|
Z-plane poles. |
Source code in pyvoicebox/v_lpcfq2zz.py
v_lpcim2ar
¶
V_LPCIM2AR - Convert impulse response to AR coefficients.
v_lpcim2ar
¶
Convert impulse response to AR coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
im
|
(array_like, shape(nf, p + 1))
|
Impulse response. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1))
|
Autoregressive coefficients. |
Source code in pyvoicebox/v_lpcim2ar.py
v_lpcis2rf
¶
V_LPCIS2RF - Convert inverse sines to reflection coefficients.
v_lpcis2rf
¶
Convert inverse sines to reflection coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_coef
|
array_like
|
Inverse sine coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rf |
ndarray
|
Reflection coefficients. |
Source code in pyvoicebox/v_lpcis2rf.py
v_lpcla2rf
¶
V_LPCLA2RF - Convert log areas to reflection coefficients.
v_lpcla2rf
¶
Convert log areas to reflection coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
la
|
(array_like, shape(nf, p + 2))
|
Log areas. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rf |
(ndarray, shape(nf, p + 1))
|
Reflection coefficients. |
Source code in pyvoicebox/v_lpcla2rf.py
v_lpclo2rf
¶
V_LPCLO2RF - Convert log area ratios to reflection coefficients.
v_lpclo2rf
¶
Convert log area ratios to reflection coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lo
|
array_like
|
Log area ratios. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rf |
ndarray
|
Reflection coefficients. |
Source code in pyvoicebox/v_lpclo2rf.py
v_lpcls2ar
¶
V_LPCLS2AR - Convert line spectrum pair frequencies to AR polynomial.
v_lpcls2ar
¶
Convert line spectrum pair frequencies to AR polynomial.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ls
|
(array_like, shape(nf, p))
|
Line spectrum pair frequencies (0 to 0.5 normalized Hz). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1))
|
Autoregressive coefficients. |
Source code in pyvoicebox/v_lpcls2ar.py
v_lpcpf2cc
¶
V_LPCPF2CC - Convert power spectrum to complex cepstrum.
v_lpcpf2cc
¶
Convert power spectrum to complex cepstrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pf
|
(array_like, shape(nf, n))
|
Power spectrum, uniformly spaced DC to Nyquist. |
required |
np_out
|
int
|
Number of cepstral coefficients to calculate. Default is n-1. |
None
|
f
|
(array_like, shape(n))
|
Frequencies of pf columns. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
cc |
(ndarray, shape(nf, np_out))
|
Complex cepstral coefficients. |
c0 |
(ndarray, shape(nf, 1))
|
Zeroth cepstral coefficient. |
Source code in pyvoicebox/v_lpcpf2cc.py
v_lpcpf2ff
¶
V_LPCPF2FF - Convert power spectrum to complex spectrum.
v_lpcpf2ff
¶
Convert power spectrum to complex spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pf
|
(array_like, shape(nf, n))
|
Power spectrum. |
required |
np_out
|
int
|
Number of complex cepstral coefficients to use. |
None
|
fi
|
array_like
|
Vector of frequencies. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ff |
(ndarray, shape(nf, n))
|
Complex spectrum. |
fo |
ndarray
|
Vector of frequencies. |
Source code in pyvoicebox/v_lpcpf2ff.py
v_lpcpf2rr
¶
V_LPCPF2RR - Convert power spectrum to autocorrelation coefficients.
v_lpcpf2rr
¶
Convert power spectrum to autocorrelation coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pf
|
(array_like, shape(nf, p2))
|
Power spectrum. |
required |
p
|
int
|
Number of output coefficients minus 1. Default is p2-2. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
rr |
(ndarray, shape(nf, p + 1))
|
Autocorrelation coefficients. |
Source code in pyvoicebox/v_lpcpf2rr.py
v_lpcpp2cw
¶
V_LPCPP2CW - Convert power spectrum polynomial to power spectrum zeros.
v_lpcpp2cw
¶
Convert power spectrum polynomial in cos(w) to power spectrum zeros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pp
|
(array_like, shape(nf, p + 1))
|
Power spectrum polynomial coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
cw |
(ndarray, shape(nf, p))
|
Power spectrum zeros (roots of the polynomial). |
Source code in pyvoicebox/v_lpcpp2cw.py
v_lpcpp2pz
¶
V_LPCPP2PZ - Convert power spectrum polynomial to power spectrum zeros.
v_lpcpp2pz
¶
Convert power spectrum polynomial in cos(w) to power spectrum zeros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pp
|
array_like
|
Power spectrum polynomial coefficients (single polynomial). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
pz |
ndarray
|
Power spectrum zeros (roots of the polynomial). |
Source code in pyvoicebox/v_lpcpp2pz.py
v_lpcpz2zz
¶
V_LPCPZ2ZZ - Power spectrum roots to LPC poles.
v_lpcpz2zz
¶
Convert power spectrum roots to LPC z-plane poles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pz
|
array_like
|
Roots of the power spectrum polynomial pp(cos(w)). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
zz |
ndarray
|
LPC z-plane poles. |
Source code in pyvoicebox/v_lpcpz2zz.py
v_lpcra2ar
¶
V_LPCRA2AR - Convert inverse filter autocorrelation coefficients to AR filter.
v_lpcra2ar
¶
Convert inverse filter autocorrelation coefficients to AR filter.
Uses a Newton-Raphson iteration (Wilson's algorithm).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
(array_like, shape(n, p + 1))
|
Each row is the second half of the autocorrelation of the coefficients of a stable AR filter of order p. |
required |
tol
|
float
|
Tolerance relative to ra[0]. Default is 1e-8. |
1e-08
|
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(n, p + 1))
|
AR filter coefficients. |
Source code in pyvoicebox/v_lpcra2ar.py
v_lpcra2pf
¶
V_LPCRA2PF - Convert inverse filter autocorrelation to power spectrum.
v_lpcra2pf
¶
Convert inverse filter autocorrelation to power spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
(array_like, shape(nf, p + 1))
|
Inverse filter autocorrelation coefficients. |
required |
np_out
|
int
|
Number of output frequencies minus 1. Default is p. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
pf |
(ndarray, shape(nf, np_out + 2))
|
Power spectrum. |
Source code in pyvoicebox/v_lpcra2pf.py
v_lpcra2pp
¶
V_LPCRA2PP - Convert inverse filter autocorrelation to power spectrum polynomial.
v_lpcra2pp
¶
Convert inverse filter autocorrelation to power spectrum polynomial in cos(w).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
(array_like, shape(nf, p + 1))
|
Inverse filter autocorrelation coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
pp |
(ndarray, shape(nf, p + 1))
|
Power spectrum polynomial coefficients. |
Source code in pyvoicebox/v_lpcra2pp.py
v_lpcrr2am
¶
V_LPCRR2AM - Convert autocorrelation coefficients to AR coefficient matrix.
v_lpcrr2am
¶
Convert autocorrelation coefficients to AR coefficient matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rr
|
(array_like, shape(nf, p + 1))
|
Autocorrelation coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
am |
(ndarray, shape(p + 1, p + 1, nf))
|
AR coefficient matrix. |
em |
(ndarray, shape(nf, p + 1))
|
Residual energy for each order. |
Source code in pyvoicebox/v_lpcrr2am.py
v_lpcrr2ar
¶
V_LPCRR2AR - Convert autocorrelation coefficients to AR coefficients.
v_lpcrr2ar
¶
Convert autocorrelation coefficients to AR coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rr
|
(array_like, shape(nf, p + 1))
|
Autocorrelation coefficients. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1))
|
AR coefficients. |
e |
(ndarray, shape(nf))
|
Residual energy. |
Source code in pyvoicebox/v_lpcrr2ar.py
v_lpcss2zz
¶
V_LPCSS2ZZ - Convert s-plane poles to z-plane poles.
v_lpcss2zz
¶
Convert s-plane poles to z-plane poles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ss
|
(array_like, shape(n, q))
|
S-plane pole positions in normalized-Hz units. |
required |
nr
|
int
|
Number of poles that should NOT be supplemented by conjugate pairs. If nr=-1, conjugate of any column containing a non-real number. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
zz |
(ndarray, shape(n, p))
|
Z-plane poles. |
Source code in pyvoicebox/v_lpcss2zz.py
v_lpczz2ar
¶
V_LPCZZ2AR - Convert z-plane poles to AR coefficients.
v_lpczz2ar
¶
Convert z-plane poles to AR coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zz
|
(array_like, shape(nf, p))
|
Z-plane poles. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ar |
(ndarray, shape(nf, p + 1))
|
AR coefficients. |
Source code in pyvoicebox/v_lpczz2ar.py
v_lpczz2cc
¶
V_LPCZZ2CC - Convert poles to complex cepstrum.
v_lpczz2cc
¶
Convert poles to complex cepstrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zz
|
(array_like, shape(nf, p))
|
Z-plane poles. |
required |
np_out
|
int
|
Number of cepstral coefficients. Default is p. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
cc |
(ndarray, shape(nf, np_out))
|
Complex cepstral coefficients. |
Source code in pyvoicebox/v_lpczz2cc.py
v_lpczz2ss
¶
V_LPCZZ2SS - Convert z-plane poles to s-plane poles.
v_lpczz2ss
¶
Convert z-plane poles to s-plane poles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zz
|
array_like
|
Z-plane poles. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ss |
ndarray
|
S-plane poles in normalized Hz units. |