.TH MEDIAN 1carl CARL
.SH NAME
median \- nonlinear filter for outputting time-varying median
.SH SYNOPSIS
.B median
[
.B -wN
] [
.B -RN
]
< floatsams > floatsams
.sp
flags: (default)
.TP
.B -wN
set window size to N seconds (default: 9S)
.TP
.B -RN
set sample rate to N (read from stdin)
.PP
Arguments may be expressions.  Use postop 'S' for samples.
.SH DESCRIPTION 
This program implements a median filter.  The median filter
is a nonlinear filter; its output at each point in
time is the median of the N most recent input values.
The attraction of such a filter is that - unlike a linear
filter - it can remove glitches while still following
step changes perfectly.  On the other hand, the median
filter does introduce a signal-dependent distortion
which depends also on the window duration.
The optimal size of the window depends on the duration of the
glitches which are to be removed.  In general, the window must
be at least twice as long as the longest glitch which it is to
remove.  (The window is always centered about the "current" sample.)
The primary application of this program is expected to be
cleaning up time-varying pitch estimates.
.LP
NOTE: If the input to
.I median
is greater 1.0 in magnitude and the output of
.I median
is piped to \fIsndout\fR, then the -of flag must be given to \fIsndout\fR
so that the stored values will be floating point as opposed to
binary.
.SH AUTHOR
Mark Dolson

