ccrma / chuck

ChucK Music Programming Language
http://chuck.stanford.edu/
GNU General Public License v2.0
778 stars 126 forks source link

Chubgraph Stereo Support [Feature Request] #71

Open kureta opened 8 years ago

kureta commented 8 years ago

I am trying to create reusable UGen chains that I can chuck in to my dac. Chubgraph looks like the way to go but it does not support stereo. It is almost completely useless this way.

spencersalazar commented 8 years ago

Yeah that will be a nice improvement, thanks for the feedback. We'll try to work on that for an upcoming release.

It is almost completely useless this way.

Im going to have to disagree with you here. Additionally, please do not use unnecessarily confrontational or hostile language in this forum- ChucK is a friendly and welcoming community and we're set on keeping it that way.

kureta commented 8 years ago

I'm truly sorry. It wasn't my intention. Thanks for the response.

dbadb commented 3 years ago

Howdy - I took a crack at adding this feature and have it for perusal on my fork here:

https://github.com/cannerycoders/chuck/tree/chugraph2

I have an example of its use here:

https://github.com/cannerycoders/chuckdoc/blob/main/src/examples/extend/chugraph2a.ck

(i converted the docs to .md and have been trying to dust them off, fwiw).

I'm happy to contribute any of this work should it be of interest.

dbadb commented 3 years ago

@gewang : any chance this could make it for the imminent release? Happy to make a pull request as you see fit.

benrogmans commented 3 years ago

You can use an array to pass multiple channels! Check the example here:

https://github.com/ccrma/chuck/blob/main/examples/stereo/array.ck

dbadb commented 3 years ago

This request is more about whether one can embody multichannel effects chains within the context of a reusable chugraph subclass.

Definitely nice that one can use arrays for multiple ugens.

benrogmans commented 3 years ago

Right. I would really like that functionality built in as well and I'm looking forward for any feedback on your work on this!

In the mean time, here is how I use arrays as a workaround:

// If you want to apply the same processing on both channels
class Mono extends Chubgraph {
    inlet => JCRev reverb => outlet;
}

public class StereoGraph {
    Mono left;
    Mono right;

    Gain inputs[2];
    Gain outputs[2];

    inputs[0] => left => outputs[0];
    inputs[1] => right => outputs[1];
}

StereoGraph reverb;

// This is the sneaky part
adc => reverb.inputs; reverb.outputs => dac;

20::second => now;

But I would definitely prefer a (your) cleaner solution :-)

dbadb commented 3 years ago

Seems like a good workaround for a class of uses. Seems like Pan2 support might be needed.