Forums > MaxMSP

### Repetition in a variable [number]

Mar 30 2009 | 11:27 am

Hello

I wonder whether someone could give me a tip where to investigate:

I have a changing number box. I would like to be able to see whether there is a pattern which repeats in a certain time.

for example:
I am thinking about to write 10 sec of data in a list (10 values: add the next number to the end of the list, and erase the last one).
If there is a repetition in the pattern, made up of 3 values for example, like:

…,0,1,5,7,7,8,9,1,5,7,…

[1,5,7]

give me a bang!

If anyone could give me a hint!
Thank you,
Krisztian

Mar 30 2009 | 1:33 pm

Hmm, good question. I don’t see a really easy solution for this. In the specific case of checking for a sequence of 3 within 10, you could check by hand (see patch below). But I couldn’t quickly think up an ingenious solution; but at the rate of 1 number input per second you have a lot of time to check things…

— Pasted Max Patch, click to expand. —
Mar 30 2009 | 5:10 pm

hi Bas

this is Very Smart! thank you, I modified it a bit so it compares the last 3 values (see below):
thank you.

hi vanille béchamel
I am just having a look in the example!
thank you.

Krisztian

— Pasted Max Patch, click to expand. —
Mar 30 2009 | 9:51 pm

thats almost the same thing i had to do once in order to find repetitions in a melody. if you break down the process into smaller tasks you will see that it only consists of easy steps. for example "write the last 3 numbers in a coll at every new number" and then "compare the running list of 3 numbers with those which are already in the coll".

nothing against vanille oracles, but you should always try algebra with some gates and buffers first.

Mar 31 2009 | 9:03 am

hello Roman Thilenius

as time is short, I will keep what I got now, but as coll has more options (might be faster as well) I will come back to it later.

thank you for all your help.
Krisztian

Mar 31 2009 | 1:18 pm

This version makes the searching a bit simpler.

_
johan

— Pasted Max Patch, click to expand. —
Mar 31 2009 | 2:10 pm

vanille béchamel

nice! is there a help file as well?

best
K

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

Forums > MaxMSP