LeopoldMozart Posted February 11 Share Posted February 11 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! Quote Link to comment Share on other sites More sharing options...
LeopoldMozart Posted February 11 Author Share Posted February 11 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. Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted February 11 Share Posted February 11 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))) Quote Link to comment Share on other sites More sharing options...
LeopoldMozart Posted February 12 Author Share Posted February 12 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. Quote Link to comment Share on other sites More sharing options...
opmo Posted February 13 Share Posted February 13 (gen-loop 4 (list (rnd-pick (list bird1 bird2 bird3)) (rnd-pick (list rest1 rest2 rest3)))) Stephane Boussuge and LeopoldMozart 2 Quote Link to comment Share on other sites More sharing options...
LeopoldMozart Posted February 13 Author Share Posted February 13 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.