[chuck-users] chuck-users Digest, Vol 103, Issue 5
Philipp Blume
pgbluster at gmail.com
Wed Feb 5 11:05:50 EST 2014
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,
<chuck-users-request at lists.cs.princeton.edu>wrote:
> Send chuck-users mailing list submissions to
> chuck-users at lists.cs.princeton.edu
>
> 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
> chuck-users-request at lists.cs.princeton.edu
>
> You can reach the person managing the list at
> chuck-users-owner at lists.cs.princeton.edu
>
> 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 <pgbluster at gmail.com>
> To: chuck-users at lists.cs.princeton.edu
> 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 <stefan.blixt at gmail.com>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> 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 <pgbluster at gmail.com> 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
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>
>>
>
>
> --
> Release me, insect, or I will destroy the Cosmos!
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
--
Philipp Blume
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140205/02f505d7/attachment.html>
More information about the chuck-users
mailing list