< Back to IRCAM Forum

Iterative Processes

Hello,
I recently discovered Openmusic and now I have some kind of problem.

I have a pretty long series of numbers which are getting very big to the end. When I play those values
it seems that the player is transposing every note over 12700 (maximum midicents value) I guess (I can’t see the notes
in the player, because they are to high up and I can’t scroll up) down as if the values over 12700 start
at octave one again. That is all fine.
But I can’t extract a midi-file with these values and be keeping the “transposition” by the player. So what I want to
do in Openmusic now is a iteration of the following process:

taking the members up to 12700 out and substracting 12700 from the rest

Those members which get taken out are all supposed to come into a new list which keeps the order of the original one but
with no member above 12700 and the rest will be fed to the process again.

I tried to do it with OMLoop, but as I see it you can only do iterative processes on one single list but on my case I have
to change the processed list every iteration.

Could someone tell me what I’m doing wrong or what would be a better way to achieve that.

Thank you in advance!

Hy FAZCL,

You are not alone (lol). Just to reinforce, I’m having exactly the same difficulty here. The list that feeds the iteration in my patch has to be different every subsequent iteration. Looking forward to read the answer.

All the best to everyone

Hi Fazcl,

What you need, if I’m not wrong, is a process called recursion.
It’s a way of programming where the patch is included in itself.

You’ll see how it works in the patch below. It has three input: one for the list, second for the low limit and third to the high limit.

All the best.

transpoct.omp (11.5 KB)

Hi Fazckl.

taking the members up to 12700 out and substracting 12700 from the rest

It sounds like you’re perhaps looking for a modulo operation on your numbers? Try (mod x 12700), or something like in the screenshot “modulo 12700”.

If you really want to do things in omloop, the ‘accum’ operator can be made to fit with almost anything. The first screenshot shows an example, doing something similar using omloop with accum and a lambda-patch.

-anders

omloop_accum_series.png

Thank you all!

@jeanmicheldarremont Thanks, your patch is really interesting. Went through it even if it took me some time.
I just got into visual programming and programming at all, so I learned some things.

 I just tried it on my set and it worked as supposed only for the beginning and then every note is within   
 a sixth or so while the min value of transpoct is 100 and max 12700. But your patch should work, shouldn't it?  

@anders Yes, the mod function is exactly what I was looking already build in. Thank you very much.
I also tried to build your loop. But I didn’t got it working. It only returns the value which gets added in the
lamba-patch. I also don’t understand what is going on in the loop. Are input0 in the lambda patch and input0
identical? Otherwise I don’t understand what happens with the loop input as it’s only going into list-loop and
nothing comes out. I didn’t get behind loops quite yet. ^^

fazckl

@fazckl I forgot to mention that the patch transpose all the notes higher than “max” or lower than “min” in the range min-max by octaves. It doesn’t delete. I don’t know what you mean by “I just tried it on my set and it worked as supposed only for the beginning and then every note is within
a sixth or so while the min value of transpoct is 100 and max 12700.” but it definitely worked for years and should do as well for what you need.
Be careful: the distance between “min” and “max” must always be higher than an octave.

Happy patching.

transpoct-exemple.png

I also tried to build your loop. But I didn’t got it working. It only returns the value which gets added in the lamba-patch.

Perhaps you forgot to collect the accumulated values at the bottom of the loop?

also don’t understand what is going on in the loop. Are input0 in the lambda patch and input0 identical? Otherwise I don’t understand what happens with the loop input as it’s only going into list-loop and nothing comes out. I didn’t get behind loops quite yet.

The list-loop (here) is just used for iteration control, ie. stopping the loop when all input elements are acted on.

The ‘accum’ takes an initial value and a lambda-patch with two inputs: no.1 sending what’s accumulated thus far, no.2 for any new input. In this case the lambda patch just returns “whatever’s accumulated thus far + 100” if that value is <= 12700, or 0 if it’s above, and stores this new value in the accumulator.

Each time through the loop the output of the accumulator is stored in a list (‘collect’) and finally the whole list is returned.

You can read more about omloop and the ‘accum’ object here:

http://support.ircam.fr/docs/om/om6-manual/co/Acum.html