[chuck-users] Interesting stereo widening effect

Rich Caloggero rjc at MIT.EDU
Thu May 29 00:34:13 EDT 2008

This "algorithm" such as it is came from an old amplifier. I think it was a 
Carver amp circa 1978. It used all analog circuitry to do the following 
(never actually heard the beast, but always wanted to implement this to see 
what it sounded like). Now, thanx to chuck, I have. I'm sure the original 
implementation didn't have randomly varying delay line lengths! <smile>

The idea is that you feed the right channel back to the left inverted and 
with delay. Do the same to the left.  Its supposed to cancel out the 
"crosstalk" between the channels thus subjectively "widening" the image.

Try it with headphones. If you crank up the gain, then you'll hear it better 
through speakers.

Thanx to the person who helped me with the inversion (sorry I forget your 
name, but you know who you are <smile>).

Here's the code:

// gain (higher produces more noticable effect)
0.4 => float gain;

// whether to invert
1 => int invert;

// delay time range
1.0 => float minDelay;
10.0 => float maxDelay;

// sound file
"music.wav" => string sourceFile;
if (me.args()) me.arg(0) => sourceFile;

// the patch
SndBuf l, r;
Step lInverted,rInverted;
DelayL dl, dr;
l => dac.left;
if (invert)
l => lInverted => dl => dac.right;
l => dl => dac.right;

r => dac.right;
if (invert)
r => rInverted => dr => dac.left;
r =>  dr => dac.left;

// set initial delay length, gain, and max delay times
.2::second => dl.max => dr.max;
4::ms => dur lDelayTime => dur rDelayTime => dl.delay => dr.delay;
gain => dl.gain => dr.gain;

// load the file
sourceFile => l.read;
sourceFile => r.read;
1 => r.channel;

// start the inverters
if (invert) spork ~ inverter(l, lInverted);
spork ~ inverter(r, rInverted);

// time loop
0 => float whichDelay;
while( true )
    .4::second => now;
Math.rand2f(0,1) => whichDelay;
if (whichDelay > .5) {
Math.rand2f(minDelay,maxDelay) * 1::ms => dl.delay;
} else {
Math.rand2f(minDelay,maxDelay) * 1::ms => dr.delay;
} // which channel to affect
} // main loop

fun void inverter(UGen in, Step out){
         - in.last() => out.next;
         1::samp => now;

More information about the chuck-users mailing list