Forums > MaxMSP

### Run into a snag with counter

Aug 03 2008 | 6:08 am

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!

Steve

Aug 03 2008 | 7:04 am

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.

-C

Aug 03 2008 | 2:26 pm

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).

— Pasted Max Patch, click to expand. —
Viewing 3 posts - 1 through 3 (of 3 total)

Forums > MaxMSP