1 /*
2 
3  * Revision 1.1  1996/08/19  22:32:17  jaf
4  * Initial revision
5  *
6 
7 */
8 
9 /*  -- translated by f2c (version 19951025).
10    You must link the resulting object file with the libraries:
11 	-lf2c -lm   (in that order)
12 */
13 
14 #include "f2c.h"
15 
16 extern int energy_(integer *len, real *speech, real *rms);
17 
18 /* ********************************************************************* */
19 
20 /* 	ENERGY Version 50 */
21 
22 /*
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. */
29 
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. */
33 
34 /* Revision 1.1  1996/02/07 14:45:40  jaf */
35 /* Initial revision */
36 
37 
38 /* ********************************************************************* */
39 
40 /* Compute RMS energy. */
41 
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 */
48 
49 /* This subroutine has no local state. */
50 
energy_(integer * len,real * speech,real * rms)51 /* Subroutine */ int energy_(integer *len, real *speech, real *rms)
52 {
53     /* System generated locals */
54     integer i__1;
55 
56     /* Builtin functions */
57     double sqrt(doublereal);
58 
59     /* Local variables */
60     integer i__;
61 
62 /*       Arguments */
63 /*       Local variables that need not be saved */
64     /* Parameter adjustments */
65     --speech;
66 
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__];
72     }
73     *rms = sqrt(*rms / *len);
74     return 0;
75 } /* energy_ */
76 
77