Jump to content

Shuffle Elements


Recommended Posts

Dear, All

 

I need a function for shuffle elements. A function similar to URN in Pure Data.

 

The scenario:

 

1) I have a list of durations:

s s -s s s -s -s -s e -s s -s s -e e -e -e s -s

2) The lenghts together form a 6/4 timesignature or a 12/8.

3) Just repeating the rhythm is BORING !

4) I need variations, but I want to still sum 12/8 or 6/4.

5) So, I need to shuffle this elements, without changing the total of the sum of lenghts.

 

TWO APPROACHES:

 

 

1) RANDOM - How to randomize, not like the random sample, but, using each element JUST ONCE,

like an Hamiltonian Path ?

(Actually I don't like to random things, because I feel like I'm not composing...) I'm a control Freak ! Sorry !

2) RANDOM2 - How can I sort from sublists of the same rhtyhm EACH LIST MUST APPEAR JUST ONCE !

This approach sounds more controled

3) MY PREFERED ! How to split the lenght list, and make up combinations of sublists (absolutely controlled) ?

Like this:

 

COMPLETE LIST - (s s -s s s -s -s -s e -s s -s s -e e -e -e s -s)

 

 

SUB LISTS 1 (s s -s)

SUB LISTS 2 (s s -s -s )

SUB LISTS 4 (-s e -s s -s)

SUB LISTS 5 (s -e e -e)

SUB LISTS 6 (-e s -s)

 

Maybe I can Initialize each one as a setf

Brute force method...

 

(setf subleng1 ' (s s -s))

(setf subleng2  '(s s -s -s ))

(setf subleng3 '(-s e -s s -s))

(setf subleng4 '(s -e e -e))

ETC....

 

And after that use assemble-seq to the lenghts ?

Or assemble-seq is just for joining sections of the composition ?

 

Any help ?

Thank you all !!!

Best,

Julio

 

 

 

 

Link to comment
Share on other sites

I'm trying this now...

Workout from Nigel Morgan book

But need some help..

 

Rhythm list

(setf r1 '(s s -s)
      r2 '(s s -s)
      r3 '(-s -s e -s)
      r4 '(s -s s -e)
      r5 '(e -e -e s -s))
      
;; shuffling 10 times
(let ((r-lis nil))
 (dotimes (i 10)
  (push (rnd-unique 5'(1 2 3 4 5)) r-lis))
 r-lis)
 
;; Here is the problem: no succes to assemble
(setf r-list (assemble-section 'r r-lis))

> Error: "3" doesn't match array element type of "r
While executing: ccl::concat-to-simple*, in process Listener-1(6).

 

Please, help !

Best,

Julio

 

Link to comment
Share on other sites

(setf r1 '(s s -s)
      r2 '(s s -s)
      r3 '(-s -s e -s)
      r4 '(s -s s -e)
      r5 '(e -e -e s -s))

You need to flatten the list first:

(setf seq
      (flatten
       (let ((r-lis nil))
         (dotimes (i 10)
           (push (rnd-unique 5 '(1 2 3 4 5)) r-lis))
         r-lis)))

(setf r-list (assemble-section 'r seq))

 

You could do that:

(setf r1 '(s s -s)
      r2 '(s s -s)
      r3 '(-s -s e -s)
      r4 '(s -s s -e)
      r5 '(e -e -e s -s))

(setf seq (flatten (gen-eval 10 '(rnd-unique 5 '(1 2 3 4 5)))))
(setf r-list (assemble-section 'r seq))

 

Link to comment
Share on other sites

6 minutes ago, opmo said:

(setf r1 '(s s -s) r2 '(s s -s) r3 '(-s -s e -s) r4 '(s -s s -e) r5 '(e -e -e s -s)) You need to flatten the list first: (setf seq (flatten (let ((r-lis nil)) (dotimes (i 10) (push (rnd-unique 5 '(1 2 3 4 5)) r-lis)) r-lis))) (setf r-list (assemble-section 'r seq))

PERFECT !!!

added 2 minutes later
9 minutes ago, opmo said:

(setf r1 '(s s -s)
      r2 '(s s -s)
      r3 '(-s -s e -s)
      r4 '(s -s s -e)
      r5 '(e -e -e s -s))

You need to flatten the list first:

(setf seq
      (flatten
       (let ((r-lis nil))
         (dotimes (i 10)
           (push (rnd-unique 5 '(1 2 3 4 5)) r-lis))
         r-lis)))

(setf r-list (assemble-section 'r seq))

 

You could do that:


(setf r1 '(s s -s)
      r2 '(s s -s)
      r3 '(-s -s e -s)
      r4 '(s -s s -e)
      r5 '(e -e -e s -s))

(setf seq (flatten (gen-eval 10 '(rnd-unique 5 '(1 2 3 4 5)))))
(setf r-list (assemble-section 'r seq))

 

More Elegant !

 

8 minutes ago, opmo said:

(setf r1 '(s s -s)
      r2 '(s s -s)
      r3 '(-s -s e -s)
      r4 '(s -s s -e)
      r5 '(e -e -e s -s))

You need to flatten the list first:

(setf seq
      (flatten
       (let ((r-lis nil))
         (dotimes (i 10)
           (push (rnd-unique 5 '(1 2 3 4 5)) r-lis))
         r-lis)))

(setf r-list (assemble-section 'r seq))

 

You could do that:


(setf r1 '(s s -s)
      r2 '(s s -s)
      r3 '(-s -s e -s)
      r4 '(s -s s -e)
      r5 '(e -e -e s -s))

(setf seq (flatten (gen-eval 10 '(rnd-unique 5 '(1 2 3 4 5)))))
(setf r-list (assemble-section 'r seq))

 

 

added 3 minutes later

Thanks a lot, Janusz !

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.

Guest
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