Jump to content

pitch swapping with iteration

Recommended Posts

Hello, I am Tamas and kind of new in Opusmodus, but learning pretty quickly. It is probably in easy case but I'm stuck at the moment:

I ha a rising c major scale, and then I always want to swap only 2 pitches at a time from the scale. At the next evaluation I want to repeat the same process but already with the previously processed new scale. Is there any way to automate this process because I only came up with this idea which is I am sure the most beginner solution 🙂 


(setf scale '(c3 d3 e3 f3 g3 a3 b3))

(setf first (position-swap (rnd-sample 2 '(0 1 2 3 4 5 6) :norep t) scale))
(setf second (position-swap (rnd-sample 2 '(0 1 2 3 4 5 6) :norep t) first))
(setf third (position-swap (rnd-sample 2 '(0 1 2 3 4 5 6) :norep t) second))
(setf fourth (position-swap (rnd-sample 2 '(0 1 2 3 4 5 6) :norep t) third))

(list first second third fourth)


Thank you all in advance! 

All the best, Tamas

Link to comment
Share on other sites

With :seq set to T you will get what you are looking for:


(setf scale '(c3 d3 e3 f3 g3 a3 b3))

(setf pos (gen-loop 4 (rnd-sample 2 '(0 1 2 3 4 5 6) :norep t)))
=> ((6 0) (0 4) (5 4) (0 2))

(position-swap pos scale :seq t)
=> ((e3 d3 c3 f3 g3 a3 b3)
    (e3 d3 g3 f3 c3 a3 b3)
    (e3 b3 g3 f3 c3 a3 d3)
    (c3 b3 g3 f3 e3 a3 d3))
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use Privacy Policy