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

Rich Caloggero rjc at MIT.EDU
Tue May 27 12:27:31 EDT 2008


This is great. Thanx so much for the code.
-- Rich

----- Original Message ----- 
From: "Atte André Jensen" <atte.jensen at gmail.com>
To: "ChucK Users Mailing List" <chuck-users at lists.cs.princeton.edu>
Sent: Tuesday, May 27, 2008 1:18 AM
Subject: Re: [chuck-users] How to Invert Phase of a Signal


> Rich Caloggero wrote:
>> 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
>
> Use "1 => r.channel" to read the second channel of a stereofile...
>
> Here's a modified example that inverts the phase of one channel. I threw 
> away the SndBuf (sine is good for testing) and delay to be able to hear 
> what's going on more clearly. So the trick is (thanks Kassen for 
> enlighting me last week) is the blackhole sample sucker + the last() for 
> reading and next for writing sample values. I think you should fairly 
> easily be able to use my inverter() function in your code...
>
> Hope that helps.
> ------------------------------
> SinOsc l => dac.left;
> SinOsc r => blackhole;
> Step inverted => dac.right;
> l => dac.left;
> r => blackhole;
>
> spork ~ inverter(r,inverted);
>
> while(true) {
>    1::second => now;
> }
>
> fun void inverter(UGen in, Step out){
>     while(true){
>         - in.last() => out.next;
>         1::samp => now;
>     }
> }
> ----------------------------------
>
> -- 
> peace, love & harmony
> Atte
>
> http://atte.dk       | http://myspace.com/attejensen
> http://anagrammer.dk | http://modlys.dk
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> 



More information about the chuck-users mailing list