README.osx wasn't easily readable in Finder. Revert back to
[sox.git] / lpc10 / lpfilt.c
blobf3caa9742fba067d40904dc7252ece2ce045ddf5
1 /*
3 * Revision 1.1 1996/08/19 22:31:35 jaf
4 * Initial revision
7 */
9 /* -- translated by f2c (version 19951025).
10 You must link the resulting object file with the libraries:
11 -lf2c -lm (in that order)
14 #include "f2c.h"
16 extern int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *nsamp);
18 /* *********************************************************************** */
20 /* LPFILT Version 55 */
23 * Revision 1.1 1996/08/19 22:31:35 jaf
24 * Initial revision
25 * */
26 /* Revision 1.3 1996/03/15 16:53:49 jaf */
27 /* Just put comment header in standard form. */
29 /* Revision 1.2 1996/03/12 23:58:06 jaf */
30 /* Comments added explaining that none of the local variables of this */
31 /* subroutine need to be saved from one invocation to the next. */
33 /* Revision 1.1 1996/02/07 14:47:44 jaf */
34 /* Initial revision */
37 /* *********************************************************************** */
39 /* 31 Point Equiripple FIR Low-Pass Filter */
40 /* Linear phase, delay = 15 samples */
42 /* Passband: ripple = 0.25 dB, cutoff = 800 Hz */
43 /* Stopband: atten. = 40. dB, cutoff = 1240 Hz */
45 /* Inputs: */
46 /* LEN - Length of speech buffers */
47 /* NSAMP - Number of samples to filter */
48 /* INBUF - Input speech buffer */
49 /* Indices len-nsamp-29 through len are read. */
50 /* Output: */
51 /* LPBUF - Low passed speech buffer (must be different array than INBUF) */
52 /* Indices len+1-nsamp through len are written. */
54 /* This subroutine has no local state. */
56 /* Subroutine */ int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *
57 nsamp)
59 /* System generated locals */
60 integer i__1;
62 /* Local variables */
63 integer j;
64 real t;
66 /* Arguments */
67 /* Parameters/constants */
68 /* Local variables that need not be saved */
69 /* Local state */
70 /* None */
71 /* Parameter adjustments */
72 --lpbuf;
73 --inbuf;
75 /* Function Body */
76 i__1 = *len;
77 for (j = *len + 1 - *nsamp; j <= i__1; ++j) {
78 t = (inbuf[j] + inbuf[j - 30]) * -.0097201988f;
79 t += (inbuf[j - 1] + inbuf[j - 29]) * -.0105179986f;
80 t += (inbuf[j - 2] + inbuf[j - 28]) * -.0083479648f;
81 t += (inbuf[j - 3] + inbuf[j - 27]) * 5.860774e-4f;
82 t += (inbuf[j - 4] + inbuf[j - 26]) * .0130892089f;
83 t += (inbuf[j - 5] + inbuf[j - 25]) * .0217052232f;
84 t += (inbuf[j - 6] + inbuf[j - 24]) * .0184161253f;
85 t += (inbuf[j - 7] + inbuf[j - 23]) * 3.39723e-4f;
86 t += (inbuf[j - 8] + inbuf[j - 22]) * -.0260797087f;
87 t += (inbuf[j - 9] + inbuf[j - 21]) * -.0455563702f;
88 t += (inbuf[j - 10] + inbuf[j - 20]) * -.040306855f;
89 t += (inbuf[j - 11] + inbuf[j - 19]) * 5.029835e-4f;
90 t += (inbuf[j - 12] + inbuf[j - 18]) * .0729262903f;
91 t += (inbuf[j - 13] + inbuf[j - 17]) * .1572008878f;
92 t += (inbuf[j - 14] + inbuf[j - 16]) * .2247288674f;
93 t += inbuf[j - 15] * .250535965f;
94 lpbuf[j] = t;
96 return 0;
97 } /* lpfilt_ */