STEREO - instrument that mixes to stereo, with static pan


STEREO(outskip, inskip, dur, ampmult, outloc0 [, outloc1, ... outlocN ])

Function table 1 gives amplitude curve.


STEREO mixes channels from the input source into the stereo output, according to the outloc arguments. The outloc arguments together constitute a ``mix matrix,'' in which argument position represents input channel number, and argument value represents output stereo location. These values are expressed as the percentage of signal to place in the left channel, from 0 (0%) to 1 (100%). So, the value of outloc0 says where to place input channel 0 in the output stereo field; the value of outloc1 says where to place input channel 1; and so on. A value of -1 directs STEREO to skip that input channel.

STEREO uses the curve provided in function table 1 to scale the amplitudes of the input source. Use setline, setexp, or makegen to create function table 1. If this table has not been created, no amplitude scaling (other than that given by ampmult) will occur.

The output of STEREO must be stereo.


p0 (outskip) output start time
p1 (inskip) input start time
p2 (dur) duration (if negative: input end time)
p3 (ampmult) amplitude multiplier
p4 (outloc0) percent (from 0 to 1) of signal from input channel 0 to place in left output channel
p5 (outloc1) percent of signal from input channel 1 to place in left output channel [optional]
p6+ (outlocN) percent of signal from input channel N to place in left output channel [optional]


The following will mix 5 seconds of the mono input source to stereo output, with the signal placed between hard left and center. No amplitude scaling will be done.

   loc = 0.75
   STEREO(outskip=0, inskip=1, dur=3, amp=1, loc)

The following will mix 2 seconds of the input source, starting from 1 second in, to stereo output. The left and right channels of the input will be swapped in the output, and amplitude will be scaled by the setline curve. The channel-swapping happens because the value of the first outloc slot, representing the left input channel, is set to pan to hard right (0% to the left), and the value of the second outloc slot, representing the right input channel, is set to pan to hard left (100% to the left).

   setline(0,0, 1,0, 4,1, 5,0)
   STEREO(outskip=0, inskip=1, dur=3, amp=1, outloc0 = 0, outloc1 = 1)

The following will read from time 2.5 to time 5.8 from channel 1 (the right channel) of a stereo input source. It scales the input by 0.5 and places it in a random output stereo location.

   inskip = 2.5
   intime_end = -5.8
   STEREO(outskip=0, inskip, intime_end, amp=0.5, -1, random())

additional STEREO commentary/examples from Luke Dubois' documentation:

STEREO is pretty much like MIX. It takes an input file(s) and writes it to the output. This isn't very exciting by itself, of course, but it can get quite interesting when you start working algorithmically, and are mixing numerous different input files together. As in MIX, the p-fields for stereo-panning are the stereo spread for the left channel and the right channel of the input file, respectively (i.e. if p4 is set to 0, the left channel of the input file will be panned hard left; if set to 1, it will be panned hard right, if set to 0.5, it will be panned center). In this instrument, you can use decimal fractions in the panning argument. Thus you can send either channel to anywhere in the stereo space.


setline(t0,a0,t1,a1...) /* the amplitude envelope of the output sound in time/amplitude pairs */

STEREO(output_start_time, input_skip, duration, amplitude, where_to_put_input_from_channel_0, where_to_put_input_from_channel_1, ... channelN) /* the duration field, if negative, specifies an absolute endtime in the output soundfile */

in comment form:

/* p0 = start_time_in_output; p1 = input_skip; p2 = dur (normal) OR if - (negative) , endtime; p3 = amp; 
   p4-n = channel mix matrix
   Note:  Don't use makegen slot 1, as it's being used by the setline envelope generator. */

An example score:

rtsetparams(44100, 2)
setline(0,0, 1, 1, 1.1, 0)
STEREO(0, 0, 3.5, 0.7, 0.5, 0.5)
setline(0,0, 0.1, 1, 1, 0)
STEREO(2, 0, 3.5, 0.7, 0.1, 0.1)

Another score, featuring a looping structure:

rtsetparams(44100, 2)
setline(0,0, .1, 1, 2,0)

dur = 1;
for(outsk = 0; outsk < 10.0; outsk = outsk + dur) {
        insk = random() * 7.0
        dur = random() * 0.2
        STEREO(insk, outsk, dur, 1, random(), -1)


setline, setexp, makegen