Thanks, Joel and JT! I got my Additive object working as a Chubgraph, exactly like I wanted.
Interestingly, I thought I'd have to connect my Additive object's signal chain before i called init(), but afterwards also seems to work just fine. Revised code is at https://gist.github.com/forrcaho/21acdb25e05a8620f56dba591cd52ed5 in case anyone is interested. On Thu, Jan 3, 2019 at 10:08 PM JP Yépez <jpyepez...@gmail.com> wrote: > Hey Forrest, > > Haven't really had a chance to take a closer look at the code, but from > your description, I think Chubgraphs might be able to help you out with > this. If you haven't tried them out, Chubgraphs have a built-in outlet, and > if you connect all AdditivePartials to it, you should be able to simply > connect/disconnect the Additive instance, which takes care of all the > partials. Here's a bit of useful info on them: > > http://chuck.stanford.edu/extend/#chubgraphs > > Chubgraphs are a good way to create your own flexible classes that can be > part of audio chains, so maybe this is something like what you have in mind? > > Hope it helps! > > JP > > On 4/01/2019, at 4:44 PM, Forrest Cahoon <forrest.cah...@gmail.com> wrote: > > Thanks! This was totally evading me. > > So even though I haven't called b.play(), its AdditivePartials will make > sound when time advances -- that's what I was missing. > Another option that works is to set the gain of each partial to 0 in init > and at the end of play(). > > What I would really like is be able to write these classes in some way > that I can connect the signal chain using the Additive object, like > > Additive a => NRev r => dac; > > which would somehow call a method on a to hook up the signal chain to all > the partials behind the scenes. Is that at all possible? > Or failing that, some other way I can specify the signal chain for > individual Additive objects outside the class (e.g. a connectSignal() > method)? > > Forrest > > > > On Thu, Jan 3, 2019 at 1:30 AM Joel Matthys <jwmatt...@gmail.com> wrote: > >> Hey Forrest. >> >> I messed around for a long time with your code before it finally struck >> me: >> >> You connected your AdditivePartials to the dac too soon! >> >> In your code you connect this=>dac when the AdditivePartials are >> instantiated, but you don't set gain and freq until you spork~ play. >> >> So when you pass the first 0.5::second => now, Additive b is sounding at >> full gain on default settings. >> >> If you move this => dac from the init function to the top of the play >> function, all is well. You should probably add this =< dac at the end of >> your play function too. >> >> Joel >> >> Sent from Mailspring >> <https://link.getmailspring.com/link/1546499923.local-a2481a69-52f7-v1.5.4-1d923...@getmailspring.com/0?redirect=https%3A%2F%2Fgetmailspring.com%2F&recipient=Y2h1Y2stdXNlcnNAbGlzdHMuY3MucHJpbmNldG9uLmVkdQ%3D%3D>, >> the best free email app for work >> On Jan 2 2019, at 10:02 pm, Forrest Cahoon <forrest.cah...@gmail.com> >> wrote: >> >> Sorry, I tried to come up with a more hello-world example of the problem >> I'm experiencing, but I really don't know what's going on so I have to post >> something a bit complex. >> >> My ChucK code is here: >> https://gist.github.com/forrcaho/21acdb25e05a8620f56dba591cd52ed5 >> <https://link.getmailspring.com/link/1546499923.local-a2481a69-52f7-v1.5.4-1d923...@getmailspring.com/1?redirect=https%3A%2F%2Fgist.github.com%2Fforrcaho%2F21acdb25e05a8620f56dba591cd52ed5&recipient=Y2h1Y2stdXNlcnNAbGlzdHMuY3MucHJpbmNldG9uLmVkdQ%3D%3D> >> >> I have a class called AdditivePartial and one called Additive which >> contains an array of AdditivePartial objects. >> >> The Additive objects play method sporks the play method for all its >> partials. >> >> The first Additive object I create appears to ignore the noteAmplitude I >> have set; it is pegged and clipping. That is, until the second Additive >> object is sporked, at which point the first object suddenly "remembers" >> it's noteAmplitude. >> >> I've looked at the output in Sonic Visualiser and that confirmed this is >> what's happening, at least on my linux machine. >> >> Can anyone reproduce this behavior, or does it work for you? If you can >> reproduce it, what the heck is going on? >> >> Forrest >> >> >> >> _______________________________________________ >> chuck-users mailing list >> chuck-users@lists.cs.princeton.edu >> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users >> >> [image: Sent from Mailspring] >> _______________________________________________ >> chuck-users mailing list >> chuck-users@lists.cs.princeton.edu >> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users >> > _______________________________________________ > chuck-users mailing list > chuck-users@lists.cs.princeton.edu > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users > > > _______________________________________________ > chuck-users mailing list > chuck-users@lists.cs.princeton.edu > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users >
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users