I attached an example that will do something like what you want, using list abs.
Without much trouble you could make this into an abstraction. It follows the first solution someone posted -- pick a bunch of random numbers and then scale them so the total equals the target. I added a few things, though -- it also rounds the numbers to the nearest subdivision that you specify, and it goes through the list and moves anything lower than the min or higher than the max duration to the min or max, compensating elsewhere, until all the durations are in range. I capped the number of searches for outliers to 1000, but you could change that or get rid of it as need be. I haven't tested this thoroughly, so let me know. MB >> Note that if you sum 1+2+3+4+5+6+7+8+9+10, that's already 55. How many time >> units do you have per 48 seconds ? (do you have a base tempo at all ?) >> >> And then what do you want the distribution to be like ? Is there any >> maximum duration of a chord, minimum duration of a chord, etc ? >> >> > It's funny that you said that. I slept over this problem and yes, I want the > chords to have a minimun and maximun duration. They don't need to bee all of > different durations, the important is this section of the piece to sound > like random/chaotic durations, and as we know random numbers (or durations?) > sometimes don't look random. I will even make this again for the attacks of > individual notes of the chords so the section will have a truly chaotic > feeling. > And by the way the tempo of this section is quarter = 60 so it's very easy > to do this. (thank you Mathieu for making me think about it more deeply) > > Thank you guys for the other answers. This really helps. > > Caio Barros
random-durations.pd
Description: Binary data
_______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list