Hmm, is this a bug?
 
In the code below, setting channelNumber to anything but zero causes a null pointer exception from the VM. I display the value of buf.channels and it says 2, meaning there should be buf.chan(0) and buf.chan(1) defined. I also get errors when I try and use buf.left or buf.right (member not defined).
 
Am I missing something here?
-- Rich
 
// sound file
"music.wav" => string filename;
0 => int channelNumber;
 
// the patch
SndBuf buf;
buf.chan(channelNumber) => dac.left;
 
// load the file
filename => buf.read;
 
<<< buf.channels() >>>;
 
// time loop
while( true )
{
 
1::second => now;
}
 
----- Original Message -----
From: Kassen
To: ChucK Users Mailing List
Sent: Friday, January 04, 2008 5:16 AM
Subject: Re: [chuck-users] Quick Newbie Question



On 04/01/2008, Rich Caloggero <rjc@mit.edu> wrote:
Is there a way to convert a stereo signal (say from a sndbuf) to two mono
signals which I can play with individually? I will then send the results of
each to dac.left and dac.right.


Hi, Rich!

If you would simply like to send a stereo soundsource to the dac in stereo ChucK will do that for you for free;

SinOsc s => Pan2 p => dac;

Equivalent would be;

SinOsc => Pan2 p;
p.left => dac.left;
p.right => dac.right;
//and even;
s => dac.chan(4);

Everything that ouputs stereo (Pan2, ADC, Mix2....) should have those .left and .right outputs. From the top of my head I can't remember is SindBuf does, these aren't mentioned in the manual where I looked just now. You could try.

Yours,
Kas.


_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users