# Robustness and Sensitivity Tuning of the Kalman Filter for Speech Enhancement
## 2 Kalman Filter for Speech Enhancement  
Assuming that the noise, \(v(n)\), is additive and uncorrelated with the clean speech, \(s(n)\), at sample \(n\), the noisy speech, \(y(n)\), can be represented as:  
\[y(n)=s(n)+v(n). \tag{1}\]  
The clean speech, \(s(n)\), can be represented by a \(p^{th}\) order autoregressive (AR) model as ([23], Chapter 8):  
\[s(n)=-\sum_{i=1}^{p}a_{i}s(n-i)+w(n), \tag{2}\]  
where \(\{a_{j};i=1,2,\ldots,p\}\) are the LPCs and \(w(n)\) is assumed to be a white noise with zero mean and variance \(\sigma_{w}^{2}\).  
Equations (1) and (2) can be used to form the following state-space model (SSM) of the KF (where the **bold** variables denote vector/matrix quantities, as opposed to unbolded variables for scalar quantities):  
\[x(n)=\mathbf{\Phi}x(n-1)+\mathbf{d}w(n), \tag{3}\] \[y(n)=\mathbf{c}^{\top}x(n)+v(n). \tag{4}\]  
In the above SSM:  
1. \(x(n)\) is a \(p\times 1\) state vector at sample \(n\), given by: \[x(n)=[s(n)\quad s(n-1)\quad\ldots\quad s(n-p+1)]^{\top},\] (5)
2. \(\mathbf{\Phi}\) is a \(p\times p\) state transition matrix, represented as: \[\mathbf{\Phi}=\begin{bmatrix}-a_{1}&-a_{2}&\ldots&-a_{p-1}&-a_{p}\\ 1&0&\ldots&0&0\\ 0&1&\ldots&0&0\\ \vdots&\vdots&\ddots&\vdots&\vdots\\ 0&0&\ldots&1&0\end{bmatrix},\] (6)
3. \(\mathbf{d}\) and \(\mathbf{c}\) are the \(p\times 1\) measurement vectors for the excitation noise and observation, written as: \[\mathbf{d}=\mathbf{c}=\begin{bmatrix}1&0&\ldots&0\end{bmatrix}^{T},\]
4. \(y(n)\) is the observed noisy speech at sample \(n\).  
During the operation of KF, the noisy speech, \(y(n)\), is windowed into non-overlapped and short (e.g., 20 ms) frames. For a particular frame, the KF recursively computes an unbiased linear MMSE estimate, \(\hat{\mathbf{x}}(n|n)\), of the state vector, \(\mathbf{x}(n)\), given the observed noisy speech up to sample \(n\), i.e., \(y(1),y(2),...,y(n)\), using the following equations [12]:  
\[\hat{\mathbf{x}}(n|n-1)=\mathbf{\Phi}\hat{\mathbf{x}}(n-1|n-1), \tag{7}\] \[\mathbf{\Psi}(n|n-1)=\mathbf{\Phi}\mathbf{\Psi}(n-1|n-1)\mathbf{\Phi}^{\top}+ \sigma_{w}^{2}\mathbf{d}d^{\top},\] (8) \[K(n)=\mathbf{\Psi}(n|n-1)\mathbf{c}[\mathbf{c}^{\top}\mathbf{\Psi}(n|n-1)\mathbf{c}+ \sigma_{v}^{2}]^{-1},\] (9) \[\hat{\mathbf{x}}(n|n)=\hat{\mathbf{x}}(n|n-1)+\mathbf{K}(n)[y(n)-\mathbf{c}^{\top} \hat{\mathbf{x}}(n|n-1)],\] (10) \[\mathbf{\Psi}(n|n)=[\mathbf{I}-\mathbf{K}(n)\mathbf{c}^{\top}]\mathbf{\Psi}(n|n-1). \tag{11}\]  
In the above Equations (7)-(11), \(\mathbf{\Psi}(n|n-1)\) and \(\mathbf{\Psi}(n|n)\) are the error covariance matrices of the a priori and a posteriori state estimates, \(\hat{\mathbf{x}}(n|n-1)\) and \(\hat{\mathbf{x}}(n|n)\); \(\mathbf{K}(n)\) is the Kalman gain; \(\sigma_{v}^{2}\) is the variance of the additive noise, \(v(n)\); and \(\mathbf{I}\) is the identity matrix. During processing of each frame, the estimated LPC parameters, (\(\{a_{i}\}\), \(\sigma_{w}^{2}\)), and noise variance, \(\sigma_{v}^{2}\), remain unchanged for that frame, while \(\mathbf{K}(n)\), \(\mathbf{\Psi}(n|n)\), and \(\hat{\mathbf{x}}(n|n)\) are continually updated on a sample-wise basis. As demonstrated in [20, 21], the estimated speech at sample \(n\) is given by: \(\hat{s}(n|n)=\mathbf{c}^{\top}\hat{\mathbf{x}}(n|n)\). Once all noisy speech frames have been processed, synthesis of the enhanced frames yields the enhanced speech, \(\hat{s}(n)\).