[Stk] Multichannel audio, RtAudio, and RtWvOut

Gary Scavone gary@ccrma.Stanford.EDU
Thu, 2 Aug 2007 12:51:54 -0400


Hi David,

You should being using RtAudio for this.  I suggest you look at:

   http://www.music.mcgill.ca/~gary/rtaudio/

for the tutorial.

Regards,

--gary

On 1-Aug-07, at 7:23 PM, David Michael wrote:

> Hello
>
> I have some questions regarding the use of STK for the playback of  
> multiple audio channels in realtime. Specifically I am trying to  
> code up a panner to handle any number of output channels (similar  
> to the NPAN in RTcmix as far as I can tell).
>
> 1) Is there a preferred realtime interface (RtAudio or RtWvOut) for  
> realtime multichannel audio data?
>
> 2) Is getting RtAudio to handle multiple channels in the callback  
> function just a matter of writing another sample to the buffer  
> pointer like so?:
>
> register StkFloat *samples = (StkFloat *) buffer;
>
> for ( int i=0; i<bufferSize; i++ ) {
>     StkFloat xxx = data->instrument->tick();
>     *samples++ = xxx; // channel 1
>     *samples++ = xxx; // channel 2
> }
>
> So for 3 channels it would look like this?:
>
> or ( int i=0; i<bufferSize; i++ ) {
>     StkFloat xxx = data->instrument->tick();
>     *samples++ = xxx; // channel 1
>     *samples++ = xxx; // channel 2
>     *samples++ = xxx; // channel 3
> }
>
> If someone would like to help clarify this aspect of RtAudio, it  
> would be much appreciated. If it is only a matter of adding another  
> buffer sample to the pointer var, then I see how I could have the  
> tick() return an array or vector. Should I be using RtWvOut instead??
>
> 3) I have searched this one out, but are there any tutorials  
> anywhere that specifically address the use on STK with multiple  
> realtime channels, or alternatively does someone on list have some  
> simple example code that they could share?
>
> Thanks in advance for your help
> Best
> David
>
> _______________________________________________
> Stk mailing list
> Stk@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk