.TH JANUS 1carl CARL
.SH NAME
janus \- smooth the attack and decay of a sound 
.SH SYNOPSIS
.B janus 
[
.B -bN
] [
.B -eN
] [
.B -RN
] [
.B -h
]
< floatsams > floatsams
.SH FLAGS
.TP
.B -b
scale beginning until time N (default= .05sec)
.TP
.B -e
start ending scaling at time N from end of file (.05sec)
.TP
.B -R
override default sampling rate for time calculations (value obtained
from header, else default= DHISR Hz)
.TP
.B -h
prints a terse usage message
.SH DESCRIPTION
The purpose of 
.B janus 
is for smoothing out the edges of a sound that may have discontinuities
which cause clicks or other undesirable noise at the beginning and/or end
of a sound.
.PP
The beginning and ending of the sound is amplitude-scaled by a portion of a
sine function over the duration of time specified with the -b and -e flags.
.PP
For the beginning of the file, the scaling function used is
.RS .5i
.sp
.EQ
Yn = Xn * 0.5 * ( cos ( pi *  i / Nb + pi ) + 1.0 )
.EN
.sp
.RE
where Nb is the number of samples to be scaled at the beginning of
the sound, and i is the current sample within that range.
For the ending of the file, the scaling function is
.RS .5i
.sp
.EQ
Yn = Xn * 0.5 * ( sin ( pi * i / Ne + pi / 2.0) + 1.0 ) )
.EN
.sp
.RE
where Ne is the number of samples to be scaled at the end, and i is
again the current sample within that range.
.PP
In between the beginning and ending scaling, the transform is simply
.RS .5i
.EQ
Yn = Xn
.EN
.RE
Sample rate is set from the value obtained from the header, if any,
else the -R flag value is used, else the compiled-in default, DHISR
is used.
.SH AUTHOR
Gareth Loy
