Repetition in a variable [number]

Mar 30, 2009 at 11:27am

Repetition in a variable [number]

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

#43103
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. –
#154477
Mar 30, 2009 at 3:47pm

hello,

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

#154478
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.

Krisztian

– Pasted Max Patch, click to expand. –
#154479
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

#154480
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.
Krisztian

#154481
Mar 31, 2009 at 9:40am

hello maxers,

you can try this…

#154482
Mar 31, 2009 at 1:18pm

This version makes the searching a bit simpler.

_
johan

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

vanille béchamel

nice! is there a help file as well?

best
K

#154484
Mar 31, 2009 at 4:17pm

hello,

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 “jesuisplouf.zip” 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

#154485

You must be logged in to reply to this topic.