simple phrase detection

anamaria's icon

Hi, I wonder if any of you have done phrase detection?

In a list of on/off patterns (0s and 1s), I would like to divide the list into sublists, if there has been a period of more than 20 0s in a row. How do i do this?

I have made an attempt here:

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks a lot for your help!

ana

Peter McCulloch's icon

How about this:
(when average of last twenty values is 0 (assuming only 0,1 input), you're good.)
zl stream 20
|
mean
|
== 0
|
change
|
sel 0 1

anamaria's icon

Hi and thank you for all this nice help.

Now I'm getting more curious: ... what if I want to look at more than just 0s and 1s - for example 0 1 and 2?

I am new to max, and I don't quite think that I can get around the t b b object ...

Please see my question in context:

Max Patch
Copy patch and select New From Clipboard in Max.

anamaria's icon

Ah, got it!

This is how I wanted to solve the problem (see below pasted patch). Thanks for all of your help!

Max Patch
Copy patch and select New From Clipboard in Max.