< Back to IRCAM Forum

Looping the result of an omloop to itself, solutions?

Hi !
I’m relatively new to OpenMusic.
So I’ve been trying to generate a chord progression following some specific transformational rules (basic neo-Riemennian transformations).

  1. Start with a randomly chosen note then harmonising it as a triad chord with a marker to indicate its nature and disposition (11, 21, 12, 22, 31 or 32)
  2. Apply a random PLR transformations (Parallel, Leading-tone, Relative) to create a following chord.
  3. Generate a sequence of 12 chords, where each chord is derived from the previous one via the PLR transformation.

I struggle with the third part. I tried to use omloop but I would need to have the input updated each time a new chord is generated because each chord is derived from the previous one. I don’t see how to do that and chatgpt/deepseek can’t propose me any good working solution.
Here is my main patch where I tried to figure out omloop but omloop applies the transformation to the same chord each time. This is not what I want. Btw I use butlast to delete the markers that I use to identify the nature of the chord.


I hope everything is clear. :sweat_smile:

Erwan LP

Dear Erwan,

I understand your problem. Your loop here is not the way you should use it. I know it is quite tricky. You need to use the accumulate (see here: OpenMusic Tutorials | OpenMusic)

However, if you wish me to look into your patch, please do send it.

Best
K

Hello Karim,

Thank you for the very quick response.
I see how to use accum and it’s indeed exactly what I need.
But now I’m struggling with another issue…
I use my transformational patch in function mode but it seems something is wrong with it but I don’t know what exactly.


Here is the inside of the ‘‘Transformations PLR’’ patch :

And OpenMusic shows me this as an error message :

Error while evaluating the box omloop : The call (#<anonymous interpreted function 80200928FC> 0 (5500 5900 6200 31)) does not match definition (#<anonymous interpreted function 80200928FC> #:g1465941).

The output of the PLR patch should match. I thought maybe it’s the zero and I tried matching the output of the PLR patch to this structure (0 (x x x x)) but same error. It’s probably something else…
I don’t think it needs an input since it’s in function mode ?

If it helps, here’s my project, the issue is in the ‘‘chromatique’’ patch :
Neo-Riemannian application.zip (218.7 KB)

Thanks a lot,
Erwan

Dear Erwan,

First of all, let me tell you that i am really impressed with all you did here. For a new beginner, it’s really impressive! :slight_smile:

Ok now, the problem is really easy:

When using a lambda function for the accum routine (in it’s third input), it should always be a binary function. Even if you don’t need a second argument, you should just create an extra input like so:

Now your computation will work.

Let me just point out few issues regarding in what you’ve sent me (a whole workspace) which is not a problem at all, i had to:

  1. remove all french accentuation in the patch names, since we must avoid strange characters not in ascii. It’s like that. Using UTF-8 and other encodings causes more problems than it brings effectiveness. So don’t use special characters when naming patches like "/ # ` ’ é à ùµ etc…

That’s why i changed the naming of some of the patches (just stripped the accents…)

  1. the changechan function is outdated. I wonder how you made it work. What OM version are you using by the way? Please replace it with set-obj-chan instead:

Screenshot_2025-08-01_23-21-51

So i am sending you a zipped folder of your project. Just unzip it and right-click in the workspace and choose ‘import folder’ (the folder is called erwan :slight_smile:

Here it is:
erwan.zip (96.6 KB)

Please let me know if all works as expected for you.

Best
Karim

1 Like

Oh I see, it was really simple indeed haha, and it works !
I also had to change the initial value of the accum to the initial chord via another input.

I fixed the issues you pinpointed in my workspace. Since I’m learning to work in OpenMusic only with online resources, it can be a bit challenging at times.
I’ve recently updated my OM to OM 7.6. The changechan comes from a post in this forum that described an issue with passing midi channel informations from a chord-seq to a VOICE then POLY. There was a file I could download and use as the changechan function.

Thank you a lot for your help !
I’m really enjoying exploring all the new possibilities OpenMusic offers to composers.

1 Like

Latching on to this thread . . I am trying to do something similar I think.

Here’s a couple quick looms to explain:

part 1:

part 2:

Thanks,
Christopher Bailey

Dear Christopher,

First it is not easy to give you solutions based on video clips. I have to build all your patch up. If you could please send a patch it would be easier.

I see in your video, one main issue in the omloop. You are not giving accum 2nd input which should be the first init value. I know accum’s loop is rather weird. But this is one main issue here.

Then i don’t think you even need a loop for that. I think you can do without it. Indeed, concat method has a third input as you noticed, used for offset.

Anyhow, if you send a basic patch example i can throw you a solution.

BEst
K

Patch(es) attached.

The reason I think I need a loop is because, the output of the concat method needs to be fed back into itself. I think that can only be done in a loop?

casimple.omp (4.2 KB)
random quick row.omp (14.6 KB)

Dear Christopher,

I think this is what you want to do:

Indeed, we had to use an omloop.

Here is the patch:

casimple1.omp (10.1 KB)

Best
K

Oh wow, yes, that does look right. I will check it out later, thank you so much!

This patch worked.

Ideally, I would like to have the offset vary somewhat from loop instance to loop instance. I tried inserting this variation at 3 different levels, and they all give an error.

Try 1 at the top level:

Try 2 at the middle level (in the OMloop):

Try 3 at the bottom level (inside “mypatch”):

No,
Since you are sending a list, you just have to use a listloop.
Then you need to round the values, concat doesn’t like floats as offset values see here:

Screenshot_2025-09-12_11-56-57

The patch:
casimple1 2.omp (11.3 KB)

Best
K