// Input : n element envelope spectral curve // Output: m lpc coefficients, excitation energy float lpc_from_curve(float[] curve, float[] lpc) { int n = ln; float[] work = new float[n + n]; float fscale = (float)(.5 / n); int i, j; // input is a real curve. make it complex-real // This mixes phase, but the LPC generation doesn't care. for (i = 0; i < n; i++) { work[i * 2] = curve[i] * fscale; work[i * 2 + 1] = 0; } work[n * 2 - 1] = curve[n - 1] * fscale; n *= 2; fft.backward(work); // The autocorrelation will not be circular. Shift, else we lose // most of the power in the edges. for (i = 0, j = n / 2; i < n / 2;) { float temp = work[i]; work[i++] = work[j]; work[j++] = temp; } return(lpc_from_data(work, lpc, n, m)); }