< Back to IRCAM Forum

Problem with sequence looping

Hello, I need some help with a patch. The problem is simple. I’m creating a series of intervals that I add to the starting pitch (dx->x). The resulting sequence of pitches initially ascend. Once it reaches its highest point (the given highest pitch), it begins to descend. Once it reaches the lowest pitch, it begins to ascend again. And so on, in a continuous cycle, until it has exhausted all pitches through this constant rising and falling.

For illustrative purposes, I call it a “snake” that “slidering” toward the upper limit. As soon as it detects that it has reached the bound or that adding another interval would cause it to break the upper limit, it begins to descend. As soon as it approaches the lower limit, it turns around and starts going up (it must not cross it). And so on, over and over.

I’m not able to write the process as a loop; I can only write the “rising” and “falling” parts themselves. The patch is attached;

thank you for your advice.

PetrH

a row of intervals.omp (11.8 KB)

Dear Petr,

If I understand you well, here is a solution using a lisp function:

Note that I don’t use dx->x nor x->dx.

Here is the folder with patches:

snake.zip (1.1 KB)

Best
K

couldnt resist - these things cry for recursive programming - which is so elegant in OM (i mean it…)


snake.zip (2.5 KB)

1 Like

Lol :slight_smile:

K

Thank you very much, Karim, and I’m sorry in the same time, but both objects (the patch and the Lisp


function) are empty…

have a nice evening, P.

Thank you very much, Anders, and you’re right—that’s exactly what I’ve been having trouble with: recursive programming. Your solution is interesting, but it doesn’t allow me to insert a pre-generated interval sequence, which can sometimes be very long and sometimes short. Or maybe I misunderstood how your patch works (I couldn’t test it—see the screenshot). Best.
death mirror
P-

Please can you try this again. I checked that all the contents are there:
snake1.zip (2.3 KB)

Yes, I can see the content now. I’m sorry—I don’t know where the problem was. Thanks again, PetrH

should be only a matter of changing from iteration and counting to poking through your list using car/cdr i think