JimmyTheSaint Posted May 1 Share Posted May 1 (setf my-sequence (make-omn :length (gen-loop times (rnd-sample 1 '((q s) (q q)))) :pitch (gen-repeat times my-pitches) :span :pitch)) (def-score my-score (:title "my-score" :key-signature 'chromatic :time-signature (gen-repeat times '((5 8 1) (4 4 1))) :tempo 161) In my-sequence, my bars are going to be a random sequence of 5/8 and 4/4. I want my score's time-signature to match, of course, but the code above will strictly alternate. It's been a very long time since I've worked with Lisp. I tried a few things using LET, but I just can't figure this out. How do I pass the current lengths generated by gen-loop's evaluations of rnd-sample so that my score ends up with a matching time-signature? I wouldn't ask for this spoonfeeding if this weren't a paradigmatic situation that I need to re-understand for various uses. Quote Link to comment Share on other sites More sharing options...
opmo Posted May 1 Share Posted May 1 Your example is not very helpful. I can't see the my-pitches values, and the times value - I need to see the my-sequence output to determine the :span :pitches use. I think the :span :pitches is the problem. What about: (setf my-sequence (make-omn :length (gen-loop times (rnd-sample 1 '((q s) (q q)))) :pitch (gen-repeat times my-pitches))) (def-score my-score (:title "my-score" :key-signature 'chromatic :time-signature (get-time-signature my-sequence) :tempo 161) Quote Link to comment Share on other sites More sharing options...
JimmyTheSaint Posted May 1 Author Share Posted May 1 OK, thanks, I thought I simplified it without losing any important info. Here's everything except the time signature: (setf my-root -24) (setf my-intervals '(0 1 4 7)) (setf my-pitches (pitch-transpose my-root (integer-to-pitch my-intervals))) (setf my-lengths (rnd-sample 1 '((q s) (q q)))) (setf times 100) (setf my-sequence (make-omn :length (gen-loop times (rnd-sample 1 '((q s) (q q)))) :pitch (gen-repeat times my-pitches) :span :pitch)) (def-score my-score (:title "my-score" :key-signature 'chromatic :time-signature <what should I put here?> :tempo 161) (instrument-1 :omn my-sequence :port 0 :channel 1 :volume 100 ) (instrument-2 :omn my-sequence :port 0 :channel 2 :volume 60) ) Quote Link to comment Share on other sites More sharing options...
opmo Posted May 1 Share Posted May 1 One possibility: (setf times 100) (setf my-root -24) (setf my-intervals '(0 1 4 7)) (setf my-pitches (pitch-transpose my-root (integer-to-pitch my-intervals))) (setf my-lengths (gen-loop times (rnd-pick '((q s) (q q))))) (setf my-sequence (make-omn :length my-lengths :pitch my-pitches)) (setf gts (get-time-signature my-sequence)) (def-score my-score (:title "my-score" :key-signature 'chromatic :time-signature gts :tempo 161) (instrument-1 :omn my-sequence :port 0 :channel 1 :volume 100 ) (instrument-2 :omn my-sequence :port 0 :channel 2 :volume 60) ) With rnd-sample: (setf my-lengths (gen-loop times (first (rnd-sample 1 '((q s) (q q)))))) JimmyTheSaint 1 Quote Link to comment Share on other sites More sharing options...
JimmyTheSaint Posted May 1 Author Share Posted May 1 Thanks, I'll study this. rnd-pick and, more importantly, get-time-signature are new for me, or more likely stuff from the tutorials that I've forgotten. Currently, I'm just trying to build toys to get used to the basic functionality and to learn what's available in the library of functions. Quote Link to comment Share on other sites More sharing options...
opmo Posted May 1 Share Posted May 1 There is no need to use gen-loop function here: (setf my-lengths (rnd-sample 100 '((q s) (q q)))) JimmyTheSaint 1 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.