.TH MIXSF 1carl CARL
.SH NAME
mixsf \- add, subtract, multiply, or interleave soundfiles
.SH SYNOPSIS
.B mixsf
[flags] soundfile < floatsams > floatsams
.nf
.RS .5i
flags:
a: add soundfile to stdin
s: subtract soundfile from stdin
m: multiply soundfile by stdin
c: divdide stdin by (energy) soundfile (for AGC)
i: interleave soundfile with stdin
x = output scale factor to avoid clipping (1.)
g = input gain factor for soundfile (1.)
b = begin time in soundfile (first sample to use) (0.)
e = end time in soundfile (last sample to use) (end)
d = duration of soundfile (end - begin)
q = quiet time before soundfile (delay before first sample)(0)
.RE
.fi
.SH DESCRIPTION 
.I mixsf
allows two soundfiles to be added (-a), subtracted (-s), multiplied (-m),
divided (-c) (e.g., a signal is divided by its temporal envelope to
implement a kind of automatic gain control - AGC) or
interleaved (-i) (e.g., two mono files become separate channels of
one stereo file).  This can always be done using
.I cmusic,
so the attraction of
.I mixsf
is simply that it allows these operations to be performed much
more easily.
.I mixsf
also provides a certain amount of amplitude and timing control.
.PP
The basic idea is that one soundfile is input via sndin on stdin
while the other soundfile is specified by a filename following
all other flags (e.g., see
.I sfnorm
).  The output to stdout always has the same duration as the input
to stdin; however, the soundfile specified in the commandline can
be either shorter or longer than this.  If it is shorter, then zeros
are added to fill out the remaining time; if it is longer, then the
excess is never used.  The -b, -e, and/or -d flags can be used to
specify that only a specific section of this soundfile should be used.
The -q flag causes zeros to be added at the beginning of this soundfile.
.PP
The user is responsible for ensuring that arithmetic overflow does not
occur.  This is controlled by the -x flag.  For example, if two soundfiles
are being added, then -x.5 will guarantee that no clipping can occur.  This
is to be distinguished from the -g flag which is also a gain control, but
which applies only to the input from the soundfile specified in the
commandline. 
.SH AUTHOR
Mark Dolson

