Repetition in a variable [number]

Mar 30, 2009 at 11:27am

Repetition in a variable [number]


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:



give me a bang!

If anyone could give me a hint!
Thank you,

Mar 30, 2009 at 1:33pm

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 at 3:47pm


that’s can be done with factor oracle algorithme (with length repeated suffix). If you like javascript (i posted “” somewhere in the forum), but you have to modify it a little bit !
I can do it for you, just ask me Smile

Mar 30, 2009 at 5:10pm

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.


– Pasted Max Patch, click to expand. –
Mar 30, 2009 at 9:51pm

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

Mar 31, 2009 at 9:03am

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.

Mar 31, 2009 at 9:40am

hello maxers,

you can try this…

Mar 31, 2009 at 1:18pm

This version makes the searching a bit simpler.


– Pasted Max Patch, click to expand. –
Mar 31, 2009 at 2:10pm

vanille béchamel

nice! is there a help file as well?


Mar 31, 2009 at 4:17pm


help file ? what do you mean ?

if you want to get info about “length repeated suffix & factor oracle”, i posted PDF from where i take the algo in “” somewhere in the forum (generative music).

sinon :

the javascript stuff is nice (vs coll way) because you can change size of repeated pattern you want to find, DURING the process.

clear message reset the memory.

right outlet give pattern repeated found.

ask for specific question, or to modify it : exercises are fun to improve the code Wink


You must be logged in to reply to this topic.