Run into a snag with counter
I’m wondering if anyone might care to have a gander at this patch and help me to understand why one small issue isn’t working out as I envisioned and how I might build this better.
In theory, this patch is supposed to:
1.) Generated a random number from 0 – 25 every second
2.) Keep count of how many numbers are generated for eight values
3.) Every first value out of eight, get another number from -5 to +5 and add it to the original number, then
4.) feed the new number back into the first random number.
Here’s my thinking:
1.) The first random number is a hypothetical note velocity which is to be between 0 and 25.
2.) The count is a hypothetical phrase length. So, in this case, the phrase is 8 notes long.
3.) The second random number between -5 and 5 creates another "range" or spread within the larger range of 0 – 25
4.) And because the first value gets set as the new velocity, my thought is that the corresponding seven values left will be within that -5 – +5 spread. So the output might be:
[cue phrase 1]: 10 12 8 15 5 8 14 11
[cue phrase 2]: 5 10 2 0 8 6 1 9
and so on… So, the first number acts as a "floor" around which the seven others hover in a given larger range…
Hope the logic makes sense.
The problem with the patch so far is that the counter skips 1! so I always get a counter sequence of 0 2 3 4 5 6 7, but yet the second random is still triggered on 2… I’m hoping for a counter sequence of 0 1 2 3 4 5 6 7…
Any help and advice for doing this cleaner would be greatly appreciated!
Quote: Steve_K wrote on Sat, 02 August 2008 23:08
> The problem with the patch so far is that the counter skips 1! so I always get a counter sequence of 0 2 3 4 5 6 7, but yet the second random is still triggered on 2… I’m hoping for a counter sequence of 0 1 2 3 4 5 6 7…
First, let me rant about one of my pet peeves about patchers when asking for help here:
You provide some information here in this thread, but none in the patcher itself. Requests for help are always better received when the problem patcher is really self-explanatory. As it stands, anyone who wants to help has to do more work than they might want to. Whew. Thanks for letting me rant.
Now, on to your problem. I think you would be better served by using counter’s Reset on Next Clock input instead of its Reset Immediately input. Send a 0 to Reset on Next Clock, and I think you may be closer.
As far as I can tell, the counter in your patch is counting:
0, 1, 2, 3, 4, 5, 6, 7
and is repeating fine without any sort of reset message.
I’m not sure which random number you were calling one and two, but I think based on the way you had your [+] set up that you should reverse it (i.e. I thought you were calling the top randomrange random number one).
See this example for labels referring to what I mean and reversed inputs on [+].
Other than that it seems to work fine (keep in mind though, if you pick a range from 0 – 25 for your first number your system could end up with negative velocities so you may want to change your range).
----------begin_max5_patcher---------- 2298.3oc6c0zbiZCF9ryuBM9z1Y8lpOP.t25o1NSOsG5kzLYvFEG1fAW.mra 2o+2q9.rwNXhrsPwrgCqyZYg38848C8JgdF99UiFOK8qr7wfeAbCXznue0nQ xlDMLp76iFuL3qyiCxkcabB64zYeY7D0OUv9Zgr4UYQIEUslrdY55hXVg7Rf ksdeZRQdz+xDsgvWW07pfh4ODkr3tL17BkjPH97eF3hk+g3H9DCuFBtc6MHJ oZ7Q0F+jfkxwe7ulEEDWIOQgx13x8mPnwh19uqtR7wDMU54oKWx1peaz5hzz GAbUELKHYAXFq3YFKATjtXQLCDjDBVxJxRqtr3nD17z0IxqE2JVsJikyugAE QoI0.F7TAT3fDeBK+XCnbe1hYptAq+6S.n5cRaifiD1cvxQfPqrDlvF.MoMX dZRdTHKCT7PTNHii5oKAbgaFuIL3CehxsG.5OYPifBR7v1vJryMCQgFzLL0V VAD3CPgQ.e.q.4jrBRORJFZCqfKQdyJCFPxQxw2HVAeSZExXOwxxYgfnjU7r RbL+lOdK3AVF6uStQlh9VP9CoOyDYlTlJUOSyD1tmSydLeBXFugUrrGBVkC9 V5ZwUrNNj28rzm48GjmxSqIPHwMfkjuNiAVkkxujxwYFadv5bF3O.IBABTjs Nu.DytWJRYQKdn.7bTwCfa3V1va+4a3HMK5I1sfOHjnBvWD8eIaBe7.gorbk nNOfOl4L1RwnHjUdZ24O9bPVXdi9UNsOcjYcQPNRGRWeYxYGUBSWrQ7Q7NEe DtUrHMo4ojqt6plJ91JlRIFKlGa7FItI0zWgQPZ0jx5L0bMcg5bJJiJSRyJC 9PJirhj80oiH0quaMUkBMXUHTbuADHjNCDNoRwNP8mxBs3hIDdVd7GQ7tJPv ShKdn1wE7wfKNmzTBphNORkW3bnQztyoFr63ZPSrT93ylnJtf+4hyRcOZScY QvHLscbfbTFa5352Xd3sBWJAF9nDEKmTmW8SMcaz38qDxUtz.WmxZS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