[chuck-users] How to Invert Phase of a Signal

Rich Caloggero rjc at MIT.EDU
Mon May 26 20:10:31 EDT 2008

OK, I'm a total beginner at all this dsp stuff, so forgive ...

One way of subjectively "widening" a stereo image is to do the following:
feed the left channel back to the right with a short delay, inverted;
feed the right channel back to the left with a short delay, inverted;

By inverted, I mean change the sign of each sample (assuming we have 
floating point samples).

So now the newbie question: how do you invert the signal? I have the rest of 
the algorithm here:

// note: sndbuf only seems to read in one channel of the source, so use one 
file for each channel of stereo source
// sound file
"r.wav"  => string right;
"l.wav"  => string left;

// the patch
SndBuf l, r;
DelayL dl, dr;
l => dac.left;
l => dl => dac.right;
r => dac.right;
r => dr => dac.left;
.2::second => dl.max => dr.max;
15::ms => dl.delay => dr.delay;
0.4 => dl.gain => dr.gain;

// load the file
left => l.read;
right => r.read;

// time loop
while( true )
    1::second => now;

-- Rich

More information about the chuck-users mailing list