Group Admins

  • Profile picture of Karim
  • Profile picture of Jean

OpenMusic

Public Group active 2 weeks, 1 day ago

User group for OpenMusic and computer-aided composition. Visit the Forum for discussions.

Randomly Interlace Lists

Author 3 Subscribed Users |
Profile photo of zipzappoozoo
zipzappoozoo

I am stuck, trying to make a patch that will do:

Given 2 lists, for example:
(1 2 3 4)
(9 10 11)

it will interlace them randomly, each of the original 2 lists is in order, but interspersed with the other list, also in order:
(1 2 9 3 10 11 4)
(9 1 2 10 11 3 4)
(1 2 3 9 10 4 11)
etc..
are all correct solutions.

(In other words, I am asking for a random solution to a partially-ordered set, I believe).

I was trying to build a patch to do this with OMLOOP, but it involves multiple ListLoops. Maybe I can figure it out, but I’m sure someone else has done this before.

Anybody?

—Chris Bailey

January 10, 2017 at 06:03 #20454
Profile photo of Karim
Karim

Dear Chris,

Here is a solution for your problem,. Unfortunately it’s in lisp (put the file in the patcehs folder and launch om)
the function is ‘2listorderedshuffle’ .

Best
K

January 10, 2017 at 15:47 #20460
Profile photo of Jean
Jean

I guess you could also try something with the OM ‘interlock’ function, too
…and use some random process to set the ‘list of indices’

January 10, 2017 at 16:00 #20463
Profile photo of Karim
Karim

Dear JEan,

I already thought of that. But unfortunately interlock doesn’t allow to interlock more than one item in a list, and with Chris examples this will not work :-)

K

January 10, 2017 at 16:01 #20464
Profile photo of Karim
Karim

Erratum, in my last comment on must read “But unfortunately interlock doesn’t allow to interlock more than one item in the same position of a list, …”

best
k

January 10, 2017 at 19:56 #20470
Profile photo of zipzappoozoo
zipzappoozoo

Thank you! that works.

Actually I had forgotten that “interlock” exists, but yes, you are correct it doesn’t quite work for what I wanted.

But this patch does, thanks.

–Chris Bailey

January 11, 2017 at 00:48 #20471

You must be logged in to reply to this topic.

Log in now