.TH MIXSND 1carl CARL
.SH NAME
mixsnd 
- csound file mixing program
.SH SYNOPSIS
.B mixsnd 
[flags] < score > samples
.sp
.nf
.RS 1i
flags:
-v	verbose, print a digested form of the score on stderr,
-bN	make sound file buffer size = N (default 16K)
-s	share open sound file descriptors if two notes play
		the same file
.RE
.SH DESCRIPTION
.fi
.B mixsnd
is a simple, monophonic, score-driven 
.I csound 
file mixer.  
It reads its 
standard input for text lines of the form:
.nf
.RS .25i
    note begin_time filename duration segment# offset gain;
.RE
where:
.RS .25i
.fi
.I note 
is the literal string, "note",
.br
.I begin_time 
is the time to start mixing in the file,
.br
.I filename 
is a (possibly partial) 
.I csound 
filename specification,
.br
.I duration 
is the length of time to mix in the file,
durations less than 0 specify the end of the sound file,
.br
.I segment#
is the segment number, if the sound file has segmentation info,
(currently unimplemented, this field is ignored)
.br
.I offset 
is an offset into the sound file of where to begin,
.br
.I gain 
is the gain.
.RE
.fi
It ignores all lines that do not begin with 
.I note 
or 
.I not, 
so you can
include comments, 
.I ter 
statements and the like, which have no effect.
.PP
Example score:
.nf
.RS .5i
note 0 /snd1/frm/av1 4 .37 -12dB;
note 1 twiddle 2 0 1/3;
note 1 /dgl/fiddle 4 24KS .25;
.RE
.fi
Expression parsing similar to 
.B cmusic
is included via 
.B expr() 
in
.B libfrm.
.PP
.B mixsnd
writes the mixed samples on the standard output.
.PP
All files are opened as soon as they are encountered in the note list
and remain open throughout the duration of the program.  This is done
to reduce the overhead of 
.I csound
file opening and closing.
.SH THE FLAGS
.IP -v
causes a digested version of the score to be printed on the standard
error output to verify interpretation of the score.  All time values
are printed first in seconds, then samples, enclosed in "[]".
.IP -bN
causes the buffer size for each sound file to be set to N.  By default
it is 16K samples.  If many files are
open however, this can backfire if the program starts getting swapped
very much.  Shortening the buffers even to 1K produces acceptable
throughput.
.IP -s
causes different notes that share the same sound file to use the same
sound file descriptor.  Again, this is an economy designed to share
buffer memory where possible.  It is not advised where two notes
play from different parts of the same sound file at the same time, as
this causes considerably greater disk i/o latency.
.SH AUTHOR
Gareth Loy
.SH SEE ALSO
sndout(1carl), sndin(1carl).
For more robust file mixing, use the 
.B sndfile
unit generator in
.B cmusic(1CARL).
