Quickstart instructions for using ECMC scripts "mixb" and "mixbsc" to mix
ambisonic B format 4 channel soundfiles.
These instructions do not cover all aspects of using these 2 scripts, but
can get you started with the most common and simplest tasks for mixing
B format soundfiles.

"mixb" runs Csound (in the background) to mix two or more B format soundfiles
together.  All of the input soundfiles MUST
 (1) be in B format, with 4 channels
 (2) have the same sampling rate (96k, 44.1k or 48 k)
 (3) have the same word size (24 bit ints, 16 bit short ints or 32 bit floats)

Csound requires an orchestra file and a score file.
Three steps are required to mix B format soundfiles with "mixb" and "mixbsc" :
(1) First run "mixbsc". This will create a Csound score file for the mix.
(2) Edit this score file, filling in a start time  and an amplitude multiplier
for each soundfile.
When the score file is ready, 
(3) Run "mixb" with appropriate flags. This will
 -> create a Csound orchestra file, and
 -> run Csound to mix the soundfiles in your score into an output soundfile,
    or else to mix the input soundfiles in real time and play the result

Typing "mixbsc" or "mixb" with no arguments will produce a usage summary.
However, both of these scripts have many options that I use but you probably
will not need, and so the usage summary may seem overly complicated.
In addition to adjusting the start times and amplitudes of each input soundfile,
"mixbsc" and "mixb" also allow you to alter the amplitude envelopes of the
input soundfiles, to transpose them in pitch, and to introduce time varying
transpositions (glissandi). These features are NOT covered in these quickstart
instructions. See me for more information on how to use them. IN the
isntructions that follow, it is assumed that you simply want to mix two or more
B format soundfiles, without altering their amplitude envelopes, skipping
into these soundfiles, or transposing them.

---------------------------------------------------------
Using  mixbsc
To simply mix 2 or more B format input soundfiles, a note/event in the score fie
with 5 parameters is required for each note. To alter the amplitude envelope,
skip a portion of a soundfile, or transpose a soundfile, 11 additional p-fields
are required. These 11 additional p-fields are not covered here.
mixbsc  has 2 flag options:
  -s produces a 'short" or "succinct" score file, without comments and with only
     5 p-fields. I recommend that you use this flag to procude "simple" score files.
  -v produces a "verbose" score file with all 16 p-fields are lots of comments.
 If neither a -s nor a -v flag is included, a score file is created with all
 16 p-fields but only a few comments.

If I want to mix 3 soundfiles named "a1mix.wxyz," "a1mix.wxyz" and "a3mix.wxyz"
I would type:
   mixbsc -s  a1mix.wxyz a2mix.wxyz a3mix.wxyz
This will display the following score file template:

 &&&&&&  Example output from "mixbsc"    &&&&&&&&&&&&&&&&&&&&
; SamplingRate 96000  WordSize 32 bits ; DO NOT ALTER OR DELETE THIS LINE 
;f60 0 1025 5 .005 1024 1.; exponential function for glissandi
 ; a 0 0 0 ; to skip into the output uncomment & change the last 0 to a skip time
 
i1  0  1.  1.   ; p4 = GLOBAL AMP. MULTIPLER {0=1.}
;(1)  a3mix1.wxyz  ----------------------------------------
i2  0  7.29  "/snd/allan/HG/SUBMIXES/a3mix1.wxyz"   1
 
;(2)  a3mix2.wxyz  ----------------------------------------
i2  0  6.11  "/snd/allan/HG/SUBMIXES/a3mix2.wxyz"   1
 
;(3)  a3mix3.wxyz  ----------------------------------------
i2  0  21.08  "/snd/allan/HG/SUBMIXES/a3mix3.wxyz"   1
 
e ;  end of score; this must be the last line
 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
 If this looks ok, and no error messages appear, repeat the command and capture
the output into a score file:
  !! > Amix.bm     or
 mixbsc -s  a1mix.wxyz a2mix.wxyz a3mix.wxyz > Amix.bm 

This will create a score file called "Amix.bm."
You can call the outputfile anything you like.  I customarily append the
extension ".bm" (for "b format mix") to the names of my B mix scorefiles
so that I know that this file is a score file for "mixb", but this is certainly
not required.

Do not change the top line the top line in the score or add any lines before it:
   ; SamplingRate 96000  WordSize 32 bits ; DO NOT ALTER OR DELETE THIS LINE 
This line is used by "mixb" to set the default output sampling rate and bit depth
for the mix.

Note that "notes" for 2 instruments are created in this score. Instrument 1
(i1) provides a global amplitude multiplier and has 4 p-fields. 
Instrument 2 (i2) reads in the input soundfiles.

Now you must edit this scorefile with a text editor such as vi or nedit.
Here is an example of an edited version of this score:

 &&&&&&&&&&& Example of edited score file &&&&&&&&&&&&&&&&&&&&&&
; SamplingRate 96000  WordSize 32 bits ; DO NOT ALTER OR DELETE THIS LINE 
;f60 0 1025 5 .005 1024 1.; exponential function for glissandi
 ; a 0 0 0 ; to skip into the output uncomment & change the last 0 to a skip time
 
i1  0  1.  .85   ; p4 = GLOBAL AMP. MULTIPLER {0=1.}
;(1)  a3mix1.wxyz  ----------------------------------------
i2  0  7.29  "/snd/allan/HG/SUBMIXES/a3mix1.wxyz"   .35
 
;(2)  a3mix2.wxyz  ----------------------------------------
i2  4.75  6.11  "/snd/allan/HG/SUBMIXES/a3mix2.wxyz"   .72
 
;(3)  a3mix3.wxyz  ----------------------------------------
i2  9.33  21.08  "/snd/allan/HG/SUBMIXES/a3mix3.wxyz"   .65
 
e ;  end of score; this must be the last line
 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Soundfile  "a3mix1" will begin at time 0 (p2) , and has an amplitude multiplier
of .35 (p5).
Soundfile  "a3mix2" will begin at time 4.75 (p2) , and has an amplitude multiplier
of .72 (p5).
Soundfile  "a3mix1" will begin at time 9.33 (p2) , and has an amplitude multiplier
of .65 (p5).
Note the p5 actss as an amplitude "fader" or multiplier for each input soundfile.
There is also a "global" fader, or amplitude multiplier, that affects ALL soundfiles
in the mix. This global fader is found in p4 of instrument 1:
    i1  0  1.  .85   ; p4 = GLOBAL AMP. MULTIPLER {0=1.}
In this case, I have set the global amplitude multiplier to .85
Thus, the samples in input soundfile a3mix1.wxyz will be multiplied by .35 and then
by .85, for a total gain of .2975. If the soundfile is at maxamp (32767),
its output within the mix will have a peak amplitude of 9478.


