.TH ENERGY 1carl CARL
.SH NAME
energy \- plot mean square energy level of function
.SH SYNOPSIS
.B energy
[
.B -wN
] [
.B -sN
] [
.B -RN
]
< floatsams > output
.sp
flags: (default)
.TP
.B -wN
set window size to N seconds (default: .01)
.TP
.B -sN
skip output by N seconds (default: half of window duration)
.TP
.B -RN
set sample rate to N (read from stdin)
.PP
Arguments may be expressions.  Use postop 'S' for samples.
If output is a file/pipe, floatsams are written.
If output is a terminal, values are printed on screen.
.SH DESCRIPTION 
.B energy
produces the root mean square of the input over a specified
window duration.
By default, the window is shifted by half its duration after
every output.
The 
.B -w 
.I (window)
flag 
causes the mean to be calculated over a window of size 
.B N, 
specified in seconds (use the postoperator 
.B S
for time in samples).
The larger the window, the smoother will be the output function.
The optimal size of the window is between one and two waveform
periods of the input signal.  (NOTE: The window is always centered
about the "current" sample.  For example, with -s100 the window is
first centered at 0S, then at 100S, 200S, etc.)
.PP
The 
.B -s 
.I (skip)
flag
effectively controls the output date rate. 
The mean square average is still computed for each sample,
but it is reported less frequently.
This decimates the output function, reducing the number of output samples
by a factor of 1/N.
The 
.B -R
flag changes the prevailing sampling rate.
.PP
NOTE: the window size and skip size are set in units of 
.I seconds
at the prevailing sampling rate.
Postoperators may be used to cause these times to be interpreted
as sample values.  For example, -s512S will make the skip factor be 512
samples.
.SH AUTHOR
Mark Dolson

