Hi Spencer, Thank you so much for answering, you saved me hours of searching, and YES, your solution exactely creates my desired result! Based on your code, I could figure out rules which were not clear for me from the manual: Blit blits[num_blits]; // I did not know one can create arrays of instances with this syntax! 0.0001 => blits[i].freq; // I did not know one could also access the member parameters of an instance this way!!! Cool! I could figure out myself that the GAIN object is MONO only, so for the PAN2s to take any effect I chucked them to the dac directly without a GAIN. This is the patch I created with your help. Sounds close to what I want to achieve. In the final patch the BLITs should all start out synchronized, and than gradually drift apart into a RAND movement, only to be combined into a nice groovy pattern later on. Here is the simple RAND part: 20 => int num_blits; Blit blits[num_blits]; Pan2 pans[num_blits]; //connecting ugens to pans, pans to dac for( 0 => int i; i < num_blits; i++ ) { blits[i] => pans[i]; pans[i]=> dac; } //randomizing parameters for( 0 => int i; i < num_blits; i++ ) { math.rand2f(0.05,0.1)=> blits[i].freq; math.rand2(0,5000) => blits[i].harmonics; math.rand2f(0.1,0.8)=> blits[i].gain; math.rand2f(-1,1)=>pans[i].pan; } 1::hour=>now; If you do not mind, two more questions: Is there a STEREO GAIN object, and how can I avoid the very loud KLICK at the very beginning in the shred? I tried fading up the gain very slowly with this code: 0.001=>float i; while (i<.9) { i=>g.gain; 1.001*i=>i; 10::samp=>now;} //this works and removes the click, but only in MONO.... Thank you again, Karl. -----Ursprüngliche Nachricht----- Von: chuck-users-bounces@lists.cs.princeton.edu [mailto:chuck-users-bounces@lists.cs.princeton.edu] Im Auftrag von Spencer Salazar Gesendet: Sonntag, 14. Januar 2007 02:39 An: ChucK Users Mailing List Betreff: Re: [chuck-users] Bulk handling of multiple instances Hi Karl, Probably the best way to go would be to allocate an array of Blits and Pans, and then loop over them to chuck them to each other and the Gain. For example: Gain g => dac; 20 => int num_blits; Blit blits[num_blits]; Pan2 pans[num_blits]; for( 0 => int i; i < num_blits; i++ ) { blits[i] => pans[i] => g; 0.0001 => blits[i].freq; 1 => blits[i].harmonics; } Does this achieve something close to your desired result? For better or for worse, ChucK lacks a lot of the dynamism of languages like Python or Perl, including features like dynamic symbol evaluation. However its typically possible to achieve similar tasks using the structures that are available (thank you Turing completeness!). spencer On Jan 13, 2007, at 7:40 PM, karl petermichl wrote:
Dear chuck-community,
My name is kar,I am a freshly converted Chukee from Vienna, Austria, Europe. Let me first thank and praise the authors of this language, the community (I went thru the WIKI, the forum and the Archives of this list), and the relaxed as well as funny and intelligent integration of wisdom in the comments and the code .
My first question is: I want to create MANY instances of a UGEN, e.g. a Blit, and route all those (lets say 20) thru their own pan2. each should be instaneated, modulated and mixed independently to the total mix. So I tried many ways to automatically create 20 Blits via Arrays, or to access in a loop the frequency of all the Blits, but so far without success. I do not want to write endless lines of code, where I manipulate each instances separately, but I thought I can write a function with an increment to do this in a loop over all the instances.
I would need something like a conceniation of strings, to have the "body" of a string the same, and add a variable to it to create the effective name of an instance or access the member of an instance:
//gain g=>dac; //for (0=>int i; i<=20; i++) {Blit "b+i" => g;} Where i would be a running number, or a string from an array. But it seems there are no mechanisms for stitching together names
I tried many variants of notation to combine the letter b with a number out of a variable to create a valid name...
I also tried the following variant via an array of strings with no success: //gain g=>dac; //["b1","b2","b3","b4","b5","b6", "b7","b8", "b9", "b10"] @=> string arr[]; //for (0=>int j; j<10; j++) {Blit arr[j] =>g;} //for (0=>int j; j<10; j++) {0.0001=>arr[j].freq;} //for (0=>int j; j<10; j++) {1=>arr[j].harmonics;}
Is there a way to do this? Thank you very much for your time, Karl.
-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.432 / Virus Database: 268.16.10/624 - Release Date: 12.01.2007 14:04
_______________________________________________ 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 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.432 / Virus Database: 268.16.10/625 - Release Date: 13.01.2007 17:40 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.432 / Virus Database: 268.16.10/625 - Release Date: 13.01.2007 17:40