fiboribo

Hello again from Miami,
Is there a way to rotate through elements of a list in a circular way with each evaluation? For example given 6000 as the starting pitch I would like to add the values (100 100 300) circularly until the maximum register of a particular instrument is reached.
I obtained the result I was looking for (see attachment) using repeatn for the list of intervals and then removing anything higher than a certain pitch using “remove.” But now I am curious to know if I could rotate through a list indefinitely, not just (as normally in OMloop) until the last element is reached. It might be useful sometime.
Thanks!
Federico
Attachments:scale.png

Karim

Dear Frederico,
I don’t know if this is what you want exactly. But the annoying thing in your patch is exactly the repeatn.. Since the algorithm is not supposed to know that you should repeat your sequence of intervals ntimes.
So you need indeed to use the loop macro (omloop) using while (c.f attached patch).
Best
K

fiboribo

Dear Karim,
Thank you very much for your prompt reply. I agree with you. The reason I was asking was exactly that it didn’t seem necessary to use repeatn without first knowing how many notes the scale would need. I do have one question about your patch: If I understand it correctly, it builds a new scale fragment adding (100 100 200) via dx>x as long as the last note of the scale fragment is lower than 9500. That means that all of the three intervals will be added at each iteration.
My initial idea was to do the following: Given 6000 as a starting pitch and (100 100 200) as my dx intervals, at each iteration add the first interval only, then the second, the third, the first, second etc. while each time checking the result and comparing it to 9500. So the scale might end with the addition of say interval no. 1 (100) or 2, and not necessarily 3.
I hope this makes sense. I suspect that the underlying issue is that my knowledge of Lisp is way too basic. That could be one of my summer projects…
Thanks,
Federico

Karim

Dear Frederico,
Yes it makes sense. You can after the loop filter out the range. But also make another more complicated iterattive loop.Best
K
