formats: clarify setting of reverse_bytes
[sox.git] / lpc10 / energy.c
blob63ec15e21334a21f28171956aca4491b6dc9552a
1 /*
3 * Revision 1.1 1996/08/19 22:32:17 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 energy_(integer *len, real *speech, real *rms);
18 /* ********************************************************************* */
20 /* ENERGY Version 50 */
23 * Revision 1.1 1996/08/19 22:32:17 jaf
24 * Initial revision
25 * */
26 /* Revision 1.3 1996/03/18 21:17:41 jaf */
27 /* Just added a few comments about which array indices of the arguments */
28 /* are used, and mentioning that this subroutine has no local state. */
30 /* Revision 1.2 1996/03/13 16:46:02 jaf */
31 /* Comments added explaining that none of the local variables of this */
32 /* subroutine need to be saved from one invocation to the next. */
34 /* Revision 1.1 1996/02/07 14:45:40 jaf */
35 /* Initial revision */
38 /* ********************************************************************* */
40 /* Compute RMS energy. */
42 /* Input: */
43 /* LEN - Length of speech buffer */
44 /* SPEECH - Speech buffer */
45 /* Indices 1 through LEN read. */
46 /* Output: */
47 /* RMS - Root Mean Square energy */
49 /* This subroutine has no local state. */
51 /* Subroutine */ int energy_(integer *len, real *speech, real *rms)
53 /* System generated locals */
54 integer i__1;
56 /* Builtin functions */
57 double sqrt(doublereal);
59 /* Local variables */
60 integer i__;
62 /* Arguments */
63 /* Local variables that need not be saved */
64 /* Parameter adjustments */
65 --speech;
67 /* Function Body */
68 *rms = 0.f;
69 i__1 = *len;
70 for (i__ = 1; i__ <= i__1; ++i__) {
71 *rms += speech[i__] * speech[i__];
73 *rms = sqrt(*rms / *len);
74 return 0;
75 } /* energy_ */