Thanks, Stefan! That did take care of my problem! I didn't even trigger a new note, I simply added the line e=<dac; at the end of my function iGen.
On Wed, Feb 5, 2014 at 2:57 AM, <[email protected]>wrote: > Send chuck-users mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of chuck-users digest..." > > Today's Topics: > > 1. Matrix of Impulse Generators (Philipp Blume) > 2. Re: Matrix of Impulse Generators (Stefan Blixt) > > > ---------- Forwarded message ---------- > From: Philipp Blume <[email protected]> > To: [email protected] > Cc: > Date: Tue, 4 Feb 2014 18:11:56 -0600 > Subject: [chuck-users] Matrix of Impulse Generators > Dear all, > > Question from a rank ChucK beginner > > There's something about envelopes or gain or shreduling that I don't > understand. > > I created a Cartesian matrix of impulse generators, whose frequencies are > given as mx+ny {x,y btw -3 and 3) where the gain & 'tempo' of each > generator is correlated with its distance from a line segment (a1,b1 - > a2,b2) - later on I will be manipulating x,y,a1,b1,a2, and b2. > > This code runs well for a while, but within a few seconds or minutes it > starts to get overwhelmed. The death is both spectacular and quite moving, > but how do I keep it within bounds so it sounds perpetually like it does in > the first 5-10 seconds? > > 550 => float x; > 440 => float y; > 3 => float a1; > 0 => float b1; > 0 => float a2; > -2 => float b2; > > fun void iGen(int i1, int j1) { > while(true) { > Euclid(i1,j1,a1,b1) + Euclid(i1,j1,a2,b2) => float dist; > <<< dist >>>; > SinOsc s => ADSR e => dac; > e.set(35::ms, 8::ms, .1, 200::ms); > Math.pow(0.65,(dist)) => s.gain; > i1*x + j1*y => s.freq; > e.keyOn(); > (440)::ms => now; > e.keyOff(); > (440*Math.pow(1.2,dist))::ms => now; > } > } > > fun float Euclid(float p, float q, float r, float s) { > return Math.sqrt(Math.pow((p-r),2) + Math.pow((q-s),2)); > } > > for(-3 => int i; i<4; i++) { > for (-3 => int j; j<4; j++) { > if (i != 0 && j != 0) { > spork ~ iGen(i,j); > } > } > } > > while (x != y) { > 500::ms=>now; > } > > -- > Philipp Blume > > > ---------- Forwarded message ---------- > From: Stefan Blixt <[email protected]> > To: ChucK Users Mailing List <[email protected]> > Cc: > Date: Wed, 5 Feb 2014 09:57:45 +0100 > Subject: Re: [chuck-users] Matrix of Impulse Generators > I sometimes get this wrong, but I think that this line: > > SinOsc s => ADSR e => dac; > > will make new connections between s, e and dac each time it's run in the > while loop - possibly creating new instances of SinOsc and ADSR each time. > Since you never disconnect from dac, this means an increasing load that may > explain the breakdown. > > > Since you want some release on the ADSR, you could make a second shred > function that deals with playing a single note, which could make sure to > disconnect e from dac one the release time has passed. Trigger the note > playing shred from your iGen function. > > /Stefan > > > On Wed, Feb 5, 2014 at 1:11 AM, Philipp Blume <[email protected]> wrote: > >> Dear all, >> >> Question from a rank ChucK beginner >> >> There's something about envelopes or gain or shreduling that I don't >> understand. >> >> I created a Cartesian matrix of impulse generators, whose frequencies are >> given as mx+ny {x,y btw -3 and 3) where the gain & 'tempo' of each >> generator is correlated with its distance from a line segment (a1,b1 - >> a2,b2) - later on I will be manipulating x,y,a1,b1,a2, and b2. >> >> This code runs well for a while, but within a few seconds or minutes it >> starts to get overwhelmed. The death is both spectacular and quite moving, >> but how do I keep it within bounds so it sounds perpetually like it does in >> the first 5-10 seconds? >> >> 550 => float x; >> 440 => float y; >> 3 => float a1; >> 0 => float b1; >> 0 => float a2; >> -2 => float b2; >> >> fun void iGen(int i1, int j1) { >> while(true) { >> Euclid(i1,j1,a1,b1) + Euclid(i1,j1,a2,b2) => float dist; >> <<< dist >>>; >> SinOsc s => ADSR e => dac; >> e.set(35::ms, 8::ms, .1, 200::ms); >> Math.pow(0.65,(dist)) => s.gain; >> i1*x + j1*y => s.freq; >> e.keyOn(); >> (440)::ms => now; >> e.keyOff(); >> (440*Math.pow(1.2,dist))::ms => now; >> } >> } >> >> fun float Euclid(float p, float q, float r, float s) { >> return Math.sqrt(Math.pow((p-r),2) + Math.pow((q-s),2)); >> } >> >> for(-3 => int i; i<4; i++) { >> for (-3 => int j; j<4; j++) { >> if (i != 0 && j != 0) { >> spork ~ iGen(i,j); >> } >> } >> } >> >> while (x != y) { >> 500::ms=>now; >> } >> >> -- >> Philipp Blume >> >> _______________________________________________ >> chuck-users mailing list >> [email protected] >> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users >> >> > > > -- > Release me, insect, or I will destroy the Cosmos! > > _______________________________________________ > chuck-users mailing list > [email protected] > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users > > -- Philipp Blume
_______________________________________________ chuck-users mailing list [email protected] https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
