Pick random points on a short time-frame
Hello everybody,
I have a fairly large patch that used both audio and video. Now I'm trying to minimise resource consumption by looking for workarounds to my clumsy patching.
I have X number of poly~ objects which I want to activate separately according to previously calculated X number of points distributed randomly over a given time-frame. For example, I would like to trigger 64 voices in 3 seconds but each of these voices would have to be triggered in different time points within this 3 second time-frame. I reckon these points would have to be stored on a look-up list so they can be used immediately, probably by reading and comparing each value on a time ramp. What would be the most economic way of achieving this? Are MSP objects better suited for this, in case I want to be generating these points constantly?
Thank you.
You could do something like this.
Thanks Christopher. Now, what would I have to change in this patch in order to make that all 64 triggers summed up don't exceed the 3000 ms (or any other predetermined time-frame)?
Sorry, I don't understand the question. This patch triggers 64 unique randomly-spaced events within 3 seconds of the initial trigger. Is that not what you wanted?
Sorry, I've never been good at explaining myself. I just meant that I would like to have a predetermined time-frame and generate X number of random points within it. So, suppose I have 6 voices and I want to trigger them at different random points between 0 and 1000ms. If I sum up these points durations they will be equal to 1000ms, or put differently, the 6 voices will all be triggered before 1000ms elapses. So, the question would be how to generate these 6 points, store them and patch something up that looks up these values while a time-framed ramp (line? phasor~?) compares its current value with those that were generated randomly. Since I have a large patch, and I'll be constantly triggering these events I want to optimise this part of the code. Any ideas, object recommendations, etc.? I must add that this part is still not part of the DSP chain so it can be done with typical controller objects.
Not to belabor this point in excess, but why do you care about the sum of the timepoints? I think the maximum is a more salient characteristic, determining the total time span of the events, and is in keeping with what you seem to want.
Having a requirement that six numbers add up to 1000 is not quite in keeping with them being chosen at "random". Do you mean uniformly distributed, or Gaussian, or...?
So the thing to consider is what kind of an effect you are actually seeking.
These all have the same sum, but "who cares?", because they take place in completely different time spans, and none of them is particularly "random"-sounding:
1) 1+2+3+4+5+985=1000 five events occurring in the first 5 ms, then one more nearly a second later
2) 164+165+166+167+168+170=1000 six events all occur within 6 ms of each other, total time 170ms
3) 36+ 89+141+193+245+296=1000 six equally spaced events about 52 ms apart, done in 296 ms
4) 1+2+3+4+494+496=1000 four events, then two more about a half second later
The effect I'm looking for is triggering different voices (+12) at sufficiently close intervals to be heard as a single event (~5000ms?), but distributed randomly to give a more organic, or gestural feel—this is because I'm working with cumulative textures rather than some kind of polyphony.
BTW, it's not that I care that much about the sum of time-points, but I just want these random events to happen always over a predetermined time-frame. For instance, I want six time-points to happen over 3000 ms; I would bang a random object between 0 and 3000, then subtract [!- 3000] to the result, and repeat the process. I have a feeling this is too laborious, and also, the result might end up as the first case you put, so I guess I would need to enforce some kind of probability distribution. Is this what you mean with Gaussian? Sorry, I'm still a newbie on aleatoric processes.
Thanks a lot for your help.
OK, after some time straining with list processing with Max I came up with this:
Any ideas how to make this more easy or smart? Also, I tried to implement Gaussian distribution but I can't make it output values from 0. to 1. (or -1. to 1.); it always escapes this boundary. How is this so?
Oops had to correct some things.