I wrote a speech enhancement code for an Android App. The algorithm runs on 256 size frames of voice samples. On my PC the code runs per about 5ms per frame, while on my Nexsus 5 it more like 50ms per frame, making the speech enhancement on a 30sec long recording run for over two minutes. On my PC, enhancing the whole audio file takes under a minute. I am looking to improve run time anywhere I can. I am attaching the code that runs per frame which is where I see biggest increase in run time.for(int j = 0; j < Consts.NUM_OF_CLUSTERS; j++){    tmp_log_h=0;    for(int k = 0; k < Consts.SIZE_OF_SEMPELS_IN_CHUNCK; k++)    {        f_X = (1/FastMath.sqrt(2*FastMath.PI*sigmaSqr.get(j).get(k)))*FastMath.exp(-(FastMath.pow(NoisySignal[k] - mue.get(j).get(k),2))/(2*sigmaSqr.get(j).get(k)));// equation (3)        F_X=(0.500 + 0.5*Erf.erf((NoisySignal[k] - mue.get(j).get(k))/(FastMath.sqrt(2*sigmaSqr.get(j).get(k)))));// equation (6)        if(j==0)        {            g_pdf_Y[k]=1/FastMath.sqrt(2*FastMath.PI*Noise_sigmaSqr.get(k))*FastMath.exp(-(FastMath.pow(NoisySignal[k] - Noise_mu.get(k),2))/(2*Noise_sigmaSqr.get(k)));// equation (4)            G_cdf_Y[k]=(0.500 + 0.5*Erf.erf((NoisySignal[k] - Noise_mu.get(k))/(FastMath.sqrt(2*Noise_sigmaSqr.get(k)))));// equation (5)        }        tmp_R_samples = (f_X/F_X);// equation (12.5)        if(j==0)        {            R_noise[k]=g_pdf_Y[k]/G_cdf_Y[k]; // equation (12.5)        }        Roe[j][k] = 1/(1 + (R_noise[k]/tmp_R_samples));        X_hat[j][k] = NoisySignal[k]*Roe[j][k]+ (mue.get(j).get(k))*(1 - Roe[j][k]) - (sigmaSqr.get(j).get(k))*((f_X*R_noise[k])/(f_X + F_X*R_noise[k]));        tmp_h_first=(f_X*G_cdf_Y[k] + F_X*g_pdf_Y[k]);// equation (7.5)                     tmp_log_h += FastMath.log(tmp_h_first); // equation (7.5)    }    Log_h_second[j]=tmp_log_h;    Log_h_final_vecotr[j]=FastMath.log(c.get(j)) + Log_h_second[j];}Double maxVi = MathHelpers.findMax(Log_h_final_vecotr);double sumExp = 0.0;for(int j = 0; j < Consts.NUM_OF_CLUSTERS; j++){    sumExp +=(FastMath.exp(Log_h_final_vecotr[j] - maxVi));// equation (18)    System.out.println(sumExp);}Log_h_final = maxVi + FastMath.log(sumExp);for(int j = 0; j < Consts.NUM_OF_CLUSTERS; j++){    Log_q[j]=FastMath.log(c.get(j)) + Log_h_second[j] - Log_h_final;    q[j]=(FastMath.exp(Log_q[j]));// equation (10)}for(int k = 0; k < Consts.SIZE_OF_SEMPELS_IN_CHUNCK; k++){    Double temp_X_estimate = 0.0;    for(int j = 0; j < Consts.NUM_OF_CLUSTERS; j++)    {        temp_X_estimate += (X_hat[j][k]*q[j]);    }       X_estimate[k]=temp_X_estimate;// equation (9)}
Performance of speech enhancement code for Android app
java;performance;android;audio;signal processing