hi Eduard, it would be really cool to be able to update individually coeffs dynamically, but it's actually impossible with the classic unit generators; changing one coefficient requires recalculating the entire table, so even if the arrays were addressed as you suggest, updating a single element of the array would trigger a complete table recalculation (and likely a click of some sort, given the brief discontinuity). that said, i'll talk over the array assignment approach with Ge and see what he thinks. i'm glad you find these useful and thanks for the ideas! dan On Aug 31, 2007, at 5:29 PM, eduard aylon wrote:
Hi Dan and all,
I've been playing around with the GenX functions and so far I find them really useful. Being able to create different curves was something I missed from the beginning. So many thanks for that. However I've found that the coefs member is a bit troublesome in that I would prefer it returned a reference to the array of coefficients instead of being a write only function which only accepts arrays. If it would return a reference to the array I imagine I wouldn't get confuse every time I assign the coefficients. So instead of
[1.,2.,3.] => gen.coefs
I think it would be more consistent with Chuck's language if one had to assign them like:
[1.,2.,3.] @=> gen.coefs()
But this is not what I find more lacking. I would like to be able to access any member of the array at any time, in order to, for instance, dynamically change the phase or strength of a particular harmonic. And also being able to have access to the .cap() function. So I'd like to do things like:
GenX gen; [1., 2., 3., 4. ] @=> gen.coefs; for( 0 => int i; i < gen.coefs().cap(); i++ ) { //do something }
instead of having to create first a temporal array, assign it to coefs and use the cap() from the first array in the for-loop. So, at the current state, the code above would translate to
GenX gen; [1., 2., 3., 4. ] @=> float a[]; a => gen.coefs for( 0 => int i; i < a.cap(); i++ ) { // do something }
and also, I'd like to be able to do:
.5 => gen.coefs()[1];
Is all this now possible? and, if not, do you think it is worth having it in future releases?
thanks,
eduard _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users