Jump to content

rnd-pick doesn't seem to work with subsets of omn


Recommended Posts

Hi folks,

Apologies if I missed the "I'm completely new to this oh god help" forum. I'm struggling to get a easy idea to work properly.

In the following snippet, I'm struggling to get the first gen-loop to function:

 

;=====BIRDCALLS=====
(setf bird1 '(3q d5 leg gs4 d5 leg gs4 d5 leg gs4))
(setf bird2 '(q a3 e. b3 x c5 leg e.. bb4))
(setf bird3 '(e fs4 leg c5 q bb4 3q fs4 stacc c5 bb4))

(setf rest1 '(-q.))
(setf rest2 '(-h))
(setf rest3 '(-w))

;=====OMN MAKER=====
(gen-loop 4 (rnd-pick '((bird1 bird2 bird3) (rest1 rest2 rest3))))
(gen-loop 4 (rnd-pick '((a4 b4 c4) (-q -h -e.)))) ;testing purposes - this kind of works


What I'm looking for is a random pick of one of the three birdcalls, following by a pick of the three rests. I've already noticed that rnd-pick isn't the way to go for that, because I want one set followed by the other, which isn't what rnd-pick is for. But evaluating the first gen-loop only returns errors. I made the second gen-loop for testing purposes, and evaluating that at least returns usable data. So:

1) Can gen-loop and rnd-pick handle variables with more that one type inside (length AND pitch AND articulattion, etc.), and, if so,

2) is there a tidier way to do what I'm after, picking between one set and another a given number of times.

Cheers!

Link to comment
Share on other sites

Thanks to ChatGPT (which doesn't know enough about Opusmodus to be of much help, but has enough understanding of Common Lisp to be useful), I have a partial solution:

 

(setf flute-omn (gen-loop 7 (rnd-pick`(,bird1 ,bird2 ,bird3 ,rest1 ,rest2 ,rest3))))


It's a simple syntax problem. I needed to use the backquote (`) along with the comma (,) operator for list splicing. This still isn't doing what I want, per se, but I can figure out the rest from here.

Link to comment
Share on other sites

Hi, you can try this:

;=====BIRDCALLS=====
(setf bird1 '(3q d5 leg gs4 d5 leg gs4 d5 leg gs4))
(setf bird2 '(q a3 e. b3 x c5 leg e.. bb4))
(setf bird3 '(e fs4 leg c5 q bb4 3q fs4 stacc c5 bb4))

(setf rest1 '(-q.))
(setf rest2 '(-h))
(setf rest3 '(-w))

;=====OMN MAKER=====
(apply-eval (rnd-sample 4 '(bird1 bird2 bird3 rest1 rest2 rest3)))

 

Link to comment
Share on other sites

On 2/11/2024 at 3:55 PM, Stephane Boussuge said:

Hi, you can try this:

;=====BIRDCALLS=====
(setf bird1 '(3q d5 leg gs4 d5 leg gs4 d5 leg gs4))
(setf bird2 '(q a3 e. b3 x c5 leg e.. bb4))
(setf bird3 '(e fs4 leg c5 q bb4 3q fs4 stacc c5 bb4))

(setf rest1 '(-q.))
(setf rest2 '(-h))
(setf rest3 '(-w))

;=====OMN MAKER=====
(apply-eval (rnd-sample 4 '(bird1 bird2 bird3 rest1 rest2 rest3)))

 


Interesting. Yep, that works, too. Thanks!

Any reason why I wouldn't want to go with the ` followed by commas solution? I'm wondering if that will may break stuff later on.

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