< Back to IRCAM Forum

Unexpected interaction between p-rewrite and p-eop? in Patterns library

Hi everyone,

I’m seeing unexpected behavior when using p-rewrite with p-eop?. I want p-rewrite to output a full generation of items at once instead of concatenating generations based on the length in p-next.

For this i tried to construct a loop that would evaluate each element of p-rewrite until reaching an end-of-period trigger. I assumed that, like with p-cycle, p-rewrite would emit such a trigger after each generation ends. However, as shown in the patch below, it never does:

demo.omp (6.9 KB)

When I run the loop, it never ends because p-eop? never triggers. Am i doing something wrong? Is there a way to achieve what i want? Or should I find a way of calculating the length of a generation based solely on its rules?

Thanks!

Also, as far as i can tell, the :generations key does not affect the output at all, no matter what i try, I think I’m using it wrong or something

(one year later…)

missed this somehow

p-eop? never triggers.

the p-eop? check only makes sense when applied to patterns, not the item(s) returned by p-next (it will return nil if you pass it anything else) - so in your example the rightmost p-eop? is always nil.

the p-eop? connected to the p-rewrite is t after every 2 elements, because you have specified 2 nodes in the pattern, ie. the “period-length” is 2

indeed, ‘generations’ is confusing ref rewrite and the other classes. it should be probably be named something else in this class, or perhaps in the other pattern classes. It has a different meaning here then in the other pattern classes, here it is indeed a ‘generation’, for the others its just an arithmetic

1 Like