Forums > MaxMSP

finding the next 1 in the list when counting through the list …


Mar 11 2011 | 12:04 pm

Hi,

Here’s challenge that seems to bug me:

I have a sequencer that counts through the numbers in a list:

1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0

then I would like to know how many positions there are to the next number one,
if the counter for example is at 2 (this would be 4 positions from 2 etc.)

Is there a nifty way of making this happen in max?

Kaspar

Mar 11 2011 | 12:29 pm

I have some of the idea working, however, it is a very complicated way of doing it, and I would like to ask, if there is an easier way?

— Pasted Max Patch, click to expand. —
Mar 11 2011 | 1:26 pm

and now the problem is solved in the below patch, however:

it is incredible how many max objects it took :-(
– hmm, I still need a more nifty way of doing it …

— Pasted Max Patch, click to expand. —
Mar 11 2011 | 6:55 pm

I’m sure there is a nifty way… maybe zl lookup and zl stream to gather groups of 0’s?

The patch below is kind of useless, didn’t get it very far, but maybe an idea or two in there.


-- Pasted Max Patch, click to expand. --


MIB
Mar 11 2011 | 7:51 pm

probably not any more nifty than what has been said, but might give you some ideas

Attachments:
  1. MRlistIt.zip
Mar 12 2011 | 10:59 pm

-- Pasted Max Patch, click to expand. --

Mar 12 2011 | 11:07 pm

Kaspar did you know that you can create a patcher inside a patch? To place all your objects inside? It can really dramatically save CPU resources. (patcher) with (inlet) and (outlet) inside, you can name the patcher too like (patcher kaspars-counter) : )

In other words, you create your own object from your counter patch, name it and use it inside other patches whilst reducing cpu load. type (patcher) and see the help file.

Mar 13 2011 | 5:45 am

great solution Luke :)

makes perfect sense…just didn’t see it!

Viewing 8 posts - 1 through 8 (of 8 total)

Forums > MaxMSP