[chuck-dev] Stereo ugens (again)

Gary Scavone gary at music.mcgill.ca
Sat Feb 10 13:45:29 EST 2007

Hi Imre,

This is an issue in STK as well.  I don't know the exact details of  
how STK classes are incorporated into ChucK (hopefully without any  
changes?) but I would like to find an elegant solution to this issue  
that works both in STK and ChucK.

First, there is something I'm not clear on in your email.  Let's take  
a Noise UGen as an example.  As it stands, the Noise class is  
inherently monophonic.  If you want multi-channel Noise, you could  
simply create multiple instances of it.  But perhaps you are asking  
that it be changed to support an arbitrary number of channels (which  
would probably be more efficient than creating multiple instances)?.   
In STK, you can pass an StkFrames object to the tick() function and  
it will fill that structure with the appropriate number of samples  
(given the number of sample frames of the StkFrames). However, as  
currently written, it only fills one channel of the StkFrames  
object.  It would be easy to modify that behavior if desired.

The next question concerns UGens that could truly be multi-channel.   
For example, reverberators tend to support one sample input and  
stereo output.  The Effect class has lastOutRight() and lastOutLeft()  
function to support stereo though the tick() function itself only  
outputs mono data.  I consider this somewhat broken.  I'd like to  
come up with a better generic solution to this problem.  One  
potential solution can be taken from the WvIn/WvOut classes, which  
have a tickFrame() function that does support arbitrary multi-channel  
input/output.  However, that structure does not make it clear how  
many channels are supported by a given class.  Also, I've heard from  
others that they would like a tick() like function that supports  
multiple channels and does not require the use of an StkFrames  
object.  I suppose we could potentially create a tickChannel()  
function that takes a channel argument(?).

I'd be happy to hear if others have ideas about how best to address  
these issues.


--Gary Scavone

On 10-Feb-07, at 8:51 AM, Imre Kéri wrote:

> Hi,
> I would like to have real stereo (or multi-channel) UGens in ChucK
> which can compute multichannel output and not just setting a pan or
> like that (like it is now??). The tick() function of an UGen should
> operate on array of samples (one sample on each channel) and produce
> also one sample for each channel as output. The audio engine should
> convert the channels if two ugens of different output/input channels
> are chucked together. Each UGen should either have a fixed number of
> in/out channels, or the user could specify the number of in/out
> channels for an UGen at construction time (to avoid extra multichannel
> processing when unnecessary). It would be not needed to access the
> individual channels of an UGen as UGens (this can be emulated e.g. by
> mono-to-stereo "split" UGens and stereo-to-mono "channel-select"
> UGens).
> I would like to implement something like this for myself because I
> think it is unconvenient that we don't have stereo ugens and some
> effects in which the channels are dependent of each other are not even
> possible to realize otherwise.
> Have you any other suggestions, advices how to implement multichannel
> ugens? It would be the best to have a solution which is good for
> everyone and which can be part of the official ChucK code.
> Or do I still not understand how multi-channel UGens work?
>    Imre Kéri
> _______________________________________________
> chuck-dev mailing list
> chuck-dev at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev

More information about the chuck-dev mailing list