[chuck-users] Quick Newbie Question

Rich Caloggero rjc at MIT.EDU
Sat Jan 5 22:35:09 EST 2008

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 at 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. 



  chuck-users mailing list
  chuck-users at lists.cs.princeton.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080105/c6a5f975/attachment.htm 

More information about the chuck-users mailing list