[chuck-users] play and record stereo with WvIn and WvOut

Robert Poor rdpoor at gmail.com
Sat Aug 15 17:20:04 EDT 2009


Michael:

Here's a code snippet I sent around April.  Might be helpful for  
playback...

> Thanks to a tip from Tom Lieber (who pointed out that WvOut doesn't  
> actually handle stereo files), here's a snippet of ChucK code people  
> might find useful:
>
> if (me.args() > 1) {
>    dac.chan(0) => Gain g0 => WvOut w0 => blackhole;
>    dac.chan(1) => Gain g1 => WvOut w1 => blackhole;
>    0.5 => g0.gain;
>    0.5 => g1.gain;
>    me.arg(0) => w0.wavFilename;
>    me.arg(1) => w1.wavFilename;
>    <<< "writing stereo output to files", me.arg(0), me.arg(1) >>>;
> } else if (me.args() > 0) {
>    dac => Gain g => WvOut w => blackhole;
>    0.5 => g.gain;
>    me.arg(0) => w.wavFilename;
>    <<< "writing mono output to file", me.arg(0) >>>;
> }
>
> Since it attaches to the dac, you can put it just about anywhere in  
> your ChucK program.  When you invoke chuck as in :
>
> % chuck mytest.ck:bleeep.wav
>
> it will write everything your program sends to the dac to a mono  
> "bleeep.wav" file.  If you invoke it as in:
>
> % chuck mytest.ck:bleep_0.wav:bleep_1.wav
>
> it will write everything you program sends to the dac to two mono  
> files: bleep_0.wav (left channel) and bleep_1.wav (right channel).   
> It's up to you to weave the two files together into a stereo sound  
> file.  There are several ways to do it -- I tend to use Audacity.
>
> - Rob

On 15 Aug 2009, at 13:50, Tom Lieber wrote:

> On Mon, Aug 3, 2009 at 1:20 PM, michael
> breitenbach<michaelbreitenbach at mac.com> wrote:
>> how ist it possible to play or record in stereo(or more channels)- 
>> aiff?
>> who can help?
>
> Save each channel to a separate WvOut.
>
> -- 
> Tom Lieber
> http://AllTom.com/
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

--:
Robert Poor
e:	robert.poor at nbt-ventures.com
p:	+1 617 818 5115
b:	http://blog.nbt-ventures.com
--:
This message and the information it contains are the proprietary and  
confidential property of NBT Ventures and may be privileged. If you  
are not the intended recipient, please do not read, copy, disclose or  
distribute its contents to any party, and notify the sender immediately.
--:



More information about the chuck-users mailing list