< 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