Linear Filters. denote a bivariate time series with zero mean. Let.
Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters...
Transcript of Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters...
![Page 2: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/2.jpg)
Parametric Models
Assume that is onto ; invert with
param. datamodel
Synthesis
Analysis
![Page 3: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/3.jpg)
Parametric ModelsQuantization
Analysis Synthesis
![Page 4: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/4.jpg)
Linear Prediction Principles
Given a sequence of values ,find the best approximation of such that:
The prediction is linear and (strictly) causal.The number is the prediction order.The prediction error/residual is defined by:
![Page 5: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/5.jpg)
Linear Prediction
+
Synthesis Filter (autoregressive)
![Page 6: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/6.jpg)
Linear PredictionCovariance Method
Solve
with
![Page 7: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/7.jpg)
Linear Prediction
Covariance Method:
![Page 8: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/8.jpg)
Linear Prediction
Unique solution if is into:
Otherwise, one solution of:
provided by:
where
![Page 9: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/9.jpg)
Linear Prediction
def lp(x, m): ”Linear predictor coefficients -- covariance method” n = len(x) A = array([x[m - 1 - arange(0, m) + i] for i in range(n-m)]) b = x[m:n] a = lstsq(A, b)[0] return a
With numpy.linalg least-square solution to :
![Page 10: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/10.jpg)
AutoCorrelation
The solutions are the same if we minimize:
Variant: treat the data as an infinite signal.Set if and minimize:
![Page 11: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/11.jpg)
AutoCorrelation
def lp(x, m, method="covariance"): ”Linear predictor coefficients - cov./autocor. methods” if method == "autocorrelation": x = r_[zeros(m), x, zeros(m)] n = len(x) A = array([x[m - 1 - arange(0, m) + i] for i in range(n-m)]) b = x[m:n] a = lstsq(A, b)[0] return a
(Implemented in the audio.lp module)
![Page 12: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/12.jpg)
Method Selection
Covariance: - Fast computation, - Accurate solution.
Autocorrelation: - Even faster computation, - Stable synthesis filter.
![Page 13: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/13.jpg)
![Page 14: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/14.jpg)
Voice Audio DataYou Wanna Have Babies ?
8 kHz, mono.
20 ms frame
![Page 15: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/15.jpg)
Voice Audio Data Short-Term Prediction
voice prediction error
order 16, autocorrelation
![Page 16: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/16.jpg)
Analysis FilterFinite Impulse Response filter - FIR
class FIR(Filter): def __call__(self, input): output = self.a[0] * input + dot(self.a[1:], self.state) self.state = r_[input, self.state[:-1]] return output
FIR
![Page 17: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/17.jpg)
FIR ExampleMoving Average
>>> from audio.filters import FIR>>> ma = FIR(0.25 * ones(4))>>> ma(1.0)0.25>>> ma(2.0)0.75>>> ma([3.0, 4.0])array([1.5, 2.5])
![Page 18: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/18.jpg)
FIR for Linear Prediction>>> a = lp(data, order=m, ...)
Predictor>>> predictor = FIR(r_[0, a])
Analysis Filter>>> error = FIR(r_[1.0, -a])
![Page 19: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/19.jpg)
Synthesis FilterAuto-Regressive filter - AR
class AR(Filter): def __call__(self, input): output = dot(self.a, self.state) + input self.state = r_[output, self.state[:-1]] return output
AR
![Page 20: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/20.jpg)
AR Example>>> from audio.filters import AR>>> ar = AR([0.5])>>> ar(1.0)1.0>>> ar(0.0)0.5>>> ar(0.0)0.25>>> ar([0.0, 0.0])array([ 0.125 , 0.0625])
![Page 21: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/21.jpg)
AR for Linear PredictionSynthesis Filter
>>> a = lp(data, m, ...)>>> synthesis = AR(a)>>> data = synthesis(error)
![Page 22: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/22.jpg)
Transfer Function
are related by:
Given , the inputs and outputs belowfilter
FIR:
AR:
![Page 23: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/23.jpg)
![Page 24: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/24.jpg)
Frequency ResponseIt can be deduced from the transfer function:
The input signal
generates the output
or equivalently
with
![Page 25: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/25.jpg)
![Page 26: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/26.jpg)
![Page 27: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/27.jpg)
Vocal Tract: Horn Model
Law of Motion
density
Compressibility
bulk modulus
: pressure
: air flow
: cross-section
![Page 28: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/28.jpg)
Webster's EquationWave Velocity Impedance
If is constant:
![Page 29: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/29.jpg)
Discrete Model
Reflection Coefficients:
![Page 30: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/30.jpg)
Ladder/Lattice FiltersKelly-Lochbaum Junction
Compensate for delay and aenuation:
![Page 31: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/31.jpg)
Linear Predictive CodingAR synthesis filters: laice filters oen replace register-based implementations.
- Levinson-Durbin and Schur algorithms are fast and provide directly the reflection coefficients that match the experimental data.
- Synthesis filter are stable iff . antize the area ratio and preserve stability:
![Page 32: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/32.jpg)
![Page 33: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/33.jpg)
![Page 34: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/34.jpg)
Basic Pitch DetectionSolve where
offset
![Page 35: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/35.jpg)
Autocorrelation Function
def ACF(data, frame_length): def normalize(x): return x / norm(x) m, n = frame_length, len(data) A = array([normalize(data[n-m-i:n-i]) for i in range(n-m+1)]) return dot(A, normalize(data[-m:]))
![Page 36: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/36.jpg)
Long-Term Prediction
LTP Synthesis (AR) Filter
LTP residual
![Page 37: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/37.jpg)
Linear Predictive Coding
parameter estimation
stp ltpAnalysis Filter
stpltpSynthesis Filter
![Page 38: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/38.jpg)
"Pure" LPC
Analysis power
whitenoise Synthesis
![Page 39: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/39.jpg)
APC / RELP
Analysis
Synthesis
Adaptative Predictive CodingResidual-Excited Linear Prediction
![Page 40: Linear Prediction · 2018. 3. 5. · Linear Predictive Coding AR synthesis filters: la ice filters o en replace register-based implementations. - Levinson-Durbin and Schur alg orithms](https://reader033.fdocuments.us/reader033/viewer/2022060517/6049a49f87cebe09b9208d33/html5/thumbnails/40.jpg)
CELPCode-Excited Linear Prediction
Analysis Synthesismatch
codebook + gain
Synthesiscodebook + gain