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