Jump to content

Get different random repeat at each draw with gen-repeat


Recommended Posts

Hello

i would like to have this function to repeat 12 times different random repeats of 3 pitches at each draw and not as it does right now 12 times the same choice .

I know it is easy but i can't recall how i can achieve this 

(setf chords
      (gen-chord2 12 3
                  (gen-repeat
                   12
                   (rnd-repeat '(3) '(c4 cs4 e4 f4 g4 gs4 a4 b4)))
                  :offset '(2)
                  :transpose '(3 8 -3)))

Thanks 

Patrick

Link to comment
Share on other sites

Sorry but i think it does the same thing 

(setf chords
      (gen-chord2 12 3 
                  (gen-repeat 12
                              (rnd-sample 3 '(c4 cs4 e4 f4 g4 gs4 a4 b4)))
                  :offset '(2)
                  :transpose '(3 8 -3)))

=> (bb4d5d5 g5eb5g5 gs4gs4e4 bb4d5d5 g5eb5g5 gs4gs4e4
   bb4d5d5 g5eb5g5 gs4gs4e4 bb4d5d5 g5eb5g5 gs4gs4e4)
It repeats several times the same set of three chords . What i am looking for is to have 12 different chords 
Link to comment
Share on other sites

Is this what you are looking for?

(gen-chord2 12 3 (flatten (gen-loop 12 (rnd-sample 3 '(c4 cs4 e4 f4 g4 gs4 a4 b4))))
 :offset '(2) :transpose '(3 8 -3))

=> (bb4d5b4 e5c5a4 bb3d4f4 b4d5gs4 cs5gs4cs5 d4a3d4
   gs4c5eb4 gs4c5cs5 d4e4cs4 g4g4b4 e5e5a4 bb3cs4f4)
Edited by opmo
Link to comment
Share on other sites

I am just looking to have 12 different repeats or draws from  

(rnd-sample 3 (c4 cs4 e4 f4 g4 gs4 a4 b4))

with at each repeat sample 3 new pitches from the list .

Or if you prefer 12 different evaluations of rnd-sample 3

It is in SCOM   

(g-eval nil  9 '(gen-random nil  3 '(a b c d e)))

This is what i am trying to do.

Thanks

Patrick

Link to comment
Share on other sites

As you can see there is no many possibilities to create chords with the pitch list  '(b4 cs4 f4)

Maybe you need to think of a different approach:

(gen-loop 12 
 (gen-chord2 12 3
  (rnd-sample 3 '(c4 cs4 e4 f4 g4 gs4 a4 b4))
  :offset (rnd-sample 12 '(0 1 2))
  :transpose (rnd-sample 12 '(3 8 -3))))
Edited by opmo
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