# Complex numbers in $\tt ifft$ of an MMSE amplitude estimator

I am trying to reconstruct a signal from a noisy speech using an MMSE algorithm proposed long time ago by Ephraim and Malah (1984). After going through the algorithm, I got a matrix A which represents the magnitude of the reconstructed signal. With the help of this group, I now know that I need to use this magnitude with the phase of the noisy signal in order to recover the signal. Now the problem is that after doing an ifft, I get complex numbers.

• Does this mean there is a mistake in implementing the algorithm?
• I read somewhere that I have to have symmetry in my input to an ifft function, how do I ensure such symmetry is applied here?

Here is my MATLAB command and the equation

A = A_hat.*exp(1i*nu);
x_new = ifft(A);


\begin{align} \hat A_k&=\Gamma\left(1.5\right)\frac{\sqrt{v_k}}{\gamma_k}M\left(-0.5;1;-v_k\right)R_k\\ &=\Gamma\left(1.5\right)\frac{\sqrt{v_k}}{\gamma_k}\exp\left(-\frac{v_k}{2}\right)\left[\left(1+v_k\right)I_0\left(\frac{v_k}{2}\right)+ v_k I_1\left(\frac{v_k}{2}\right)\right]R_k.\tag{7} \end{align}

Note that the MMSE estimator gives you a real-valued gain function with which the noisy signal amplitude is modified. Equation (7) is actually

$$\hat{A}_k=G_kR_k\tag{1}$$

where the gain $G_k$ is a function of $v_k$ and $\gamma_k$. You want to reconstruct the original signal as

$$\hat{X}_k=\hat{A}_ke^{j\phi_k}\tag{2}$$

where $\phi_k$ is the phase of the noisy signal $Y_k=R_ke^{j\phi_k}$. Combining (1) and (2) gives

$$\hat{X}_k=G_kR_ke^{j\phi_k}=G_kY_k\tag{3}$$

So you can simply multiply the complex spectral component of the noisy signal with the gain $G_k$ to get the estimation of the spectral component of the input signal.

In Matlab this is easily done. You just have to extend the gain vector to satisfy the symmetry condition for real-valued signals:

X = Y.*[gain; gain(N-1:-1:2];


where I assume that the vector gain has elements $G_k$, and that N is its length. The relation between the FFT length and N is N = Nfft/2+1.

• Thank you very much. Your explanation is very clear and I am now gaining an understanding of the paper. I need to create symmetry in order to take the ifft. However, there is a problem in sizing with Y and Gain. Let us say that Yk is a vector produced from fft function and returns NFFT points. When I calculate the Gain vector Gk from equation (7), I will also have NFFT points (not NFFT/2+1). This is because Âk will correspond to each point in Y. I can fix the matlab code by either doing: X = [Y;Y].*[Gain; Gain(N:-1:1)] Or somehow cut the gain function in half ?!! – Mona Nov 29 '14 at 2:50
• @Mona: If you computed the gain vector for all values of $k$, then you can simply do X = Y.*G. You just did twice as many computations as necessary because the gain vector is symmetric. Check the values of $G_k$ and you will notice that $G_k=G_{N-k}$, $k=0,\ldots,N_{fft}$. – Matt L. Nov 29 '14 at 13:08
• Thank you very much for the clarifications..... I calculated the gain, but I am not getting the symmetry. I must have done something wrong in my calculations of equation (7). I will go back and check my code... Thanks again – Mona Nov 29 '14 at 23:53
• The problem with my code was the way i was calculating E{|Dk|^2} . Now that I fixed it (or at least I think I did) I am getting weird results. The sound of the recovered signal is awful, it sounds like there is music instruments added. I looked at the gain matrix and for some kth component, i'm getting high gain in the order of thousands or so. What should the range of gain be? Thanks in advance – Mona Dec 2 '14 at 12:34
• @Mona: Yeah, you're hearing musical noise. And there's still a problem in the gain computation. Think about it: what should the gain do when the SNR is very good? It should be (close to) $1$, i.e. pass everything. When the SNR is bad, it should decrease down to (almost) $0$ for very bad SNR. So the range of the gain should be more or less $[\epsilon,1]$, where $\epsilon$ is some small constant. – Matt L. Dec 2 '14 at 16:08