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)); }
void lpc_to_curve(float[] curve, float[] lpc, float amp) { for (int i = 0; i < ln * 2; i++) curve[i] = 0.0f; if (amp == 0) return; for (int i = 0; i < m; i++) { curve[i * 2 + 1] = lpc[i] / (4 * amp); curve[i * 2 + 2] = -lpc[i] / (4 * amp); } fft.backward(curve); { int l2 = ln * 2; float unit = (float) (1. / amp); curve[0] = (float) (1. / (curve[0] * 2 + unit)); for (int i = 1; i < ln; i++) { float real = (curve[i] + curve[l2 - i]); float imag = (curve[i] - curve[l2 - i]); float a = real + unit; curve[i] = (float) (1.0 / FAST_HYPOT(a, imag)); } } } }
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)); }
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)); }
void lpc_to_curve(float[] curve, float[] lpc, float amp){ for(int i=0; i<ln*2; i++) curve[i]=0.0f; if(amp==0) return; for(int i=0; i<m; i++){ curve[i*2+1]=lpc[i]/(4*amp); curve[i*2+2]=-lpc[i]/(4*amp); } fft.backward(curve); { int l2=ln*2; float unit=(float)(1./amp); curve[0]=(float)(1./(curve[0]*2+unit)); for(int i=1; i<ln; i++){ float real=(curve[i]+curve[l2-i]); float imag=(curve[i]-curve[l2-i]); float a=real+unit; curve[i]=(float)(1.0/FAST_HYPOT(a, imag)); } } } }
void lpc_to_curve(float[] curve, float[] lpc, float amp){ for(int i=0; i<ln*2; i++) curve[i]=0.0f; if(amp==0) return; for(int i=0; i<m; i++){ curve[i*2+1]=lpc[i]/(4*amp); curve[i*2+2]=-lpc[i]/(4*amp); } fft.backward(curve); { int l2=ln*2; float unit=(float)(1./amp); curve[0]=(float)(1./(curve[0]*2+unit)); for(int i=1; i<ln; i++){ float real=(curve[i]+curve[l2-i]); float imag=(curve[i]-curve[l2-i]); float a=real+unit; curve[i]=(float)(1.0/FAST_HYPOT(a, imag)); } } } }
void lpc_to_curve(float[] curve, float[] lpc, float amp){ for(int i=0; i<ln*2; i++) curve[i]=0.0f; if(amp==0) return; for(int i=0; i<m; i++){ curve[i*2+1]=lpc[i]/(4*amp); curve[i*2+2]=-lpc[i]/(4*amp); } fft.backward(curve); { int l2=ln*2; float unit=(float)(1./amp); curve[0]=(float)(1./(curve[0]*2+unit)); for(int i=1; i<ln; i++){ float real=(curve[i]+curve[l2-i]); float imag=(curve[i]-curve[l2-i]); float a=real+unit; curve[i]=(float)(1.0/FAST_HYPOT(a, imag)); } } } }
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)); }
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)); }
void lpc_to_curve(float[] curve, float[] lpc, float amp){ for(int i=0; i<ln*2; i++) curve[i]=0.0f; if(amp==0) return; for(int i=0; i<m; i++){ curve[i*2+1]=lpc[i]/(4*amp); curve[i*2+2]=-lpc[i]/(4*amp); } fft.backward(curve); { int l2=ln*2; float unit=(float)(1./amp); curve[0]=(float)(1./(curve[0]*2+unit)); for(int i=1; i<ln; i++){ float real=(curve[i]+curve[l2-i]); float imag=(curve[i]-curve[l2-i]); float a=real+unit; curve[i]=(float)(1.0/FAST_HYPOT(a, imag)); } } } }