Jump to content

Featured Replies

Posted

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!

  • Author

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.

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)))

 

  • Author
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.

  • Author
23 minutes ago, opmo said:
(gen-loop 4 (list
             (rnd-pick (list bird1 bird2 bird3))
             (rnd-pick (list rest1 rest2 rest3))))

 

You guys are brilliant. Thank you.

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy