david Posted August 5, 2024 Posted August 5, 2024 Hi, I have a list (setf exo '((e c4 e4 g4 a4)(e4 g4 bb4 c5)(f4 a4 c5 d5)(fs4 a4 c5 eb5)(g4 a4 c5 e5)( -h)(e a4 g4 e4 c4)( c5 bb4 g4 e4)( d5 c5 a4 f4)(eb5 c5 a4 fs4)(e5 c5 a4 g4)( -h))) with the find-bar function I want this new result (find-bar '(1 8 3 10 5) exo) Is it possible to get this result with a seed? (setf loopbars (omn-to-measure (loop for bar in exo collect (list (filter-repeat 1 (rnd-order (first (gen-divide 4 bar)) :type :pitch :seed 8)) (filter-repeat 1 (rnd-order (second (gen-divide 4 bar)) :type :pitch :seed 8)))) 4/4)) Thanks for your help Quote
jesele Posted August 6, 2024 Posted August 6, 2024 Hi David. You could randomize like this: (setf exo '((e c4 e4 g4 a4)(e4 g4 bb4 c5)(f4 a4 c5 d5)(fs4 a4 c5 eb5)(g4 a4 c5 e5)( -h)(e a4 g4 e4 c4)( c5 bb4 g4 e4)( d5 c5 a4 f4)(eb5 c5 a4 fs4)(e5 c5 a4 g4)( -h))) (setf bars (rnd-order (loop for i from 1 to (length exo) collect i) :seed 8)) ;;or if you only want 5 bars (setf bars (subseq bars 0 5)) (setf loopbars (find-bar bars exo)) Maybe this is better: (can result in duplicate bars though) ;; 5 numbers between 1 and the length of exo (setf bars (rndn 5 1 (length exo) :seed 8)) (setf loopbars (find-bar bars exo)) Even better: ;; no duplicates (setf bars (rnd-unique 5 (loop for i from 1 to (length exo) collect i) :seed 8)) (setf loopbars (find-bar bars exo)) Jesper Quote
david Posted August 6, 2024 Author Posted August 6, 2024 thanks for your answer Jesper. sorry, I expressed myself badly. I tried several seeds with my code and I never find the result I want. is there a way to check the real results, I mean I have 4 notes with gen-divide... which gives 24 possibilities... logically I should have the result I want with the first 30 seeds, rigth? (I left seed 8 because I still hadn't found my result after 40 seeds) (setf loopbars (omn-to-measure (loop for bar in exo collect (list (filter-repeat 1 (rnd-order (first (gen-divide 4 bar)) :type :pitch :seed 8)) (filter-repeat 1 (rnd-order (second (gen-divide 4 bar)) :type :pitch :seed 8)))) 4/4)) I would like to point out that I am still on version 2. OM, some functions of your code do not work on my version Quote
jesele Posted August 6, 2024 Posted August 6, 2024 Sorry, I don't understand what you are trying to do. ;; test with the first bar of your loop (loop for bar in exo collect etc. (setf bar (first exo)) ;; then you do (filter-repeat 1 (rnd-order (first (gen-divide 4 bar)) :type :pitch :seed 8)) =>(e a4 g4 c4 e4) ;;and then this which results in nil, there is no second of (gen-divide 4 bar) (filter-repeat 1 (rnd-order (second (gen-divide 4 bar)) :type :pitch :seed 8)) ;; this will do the same thing, so why gen-divide 4 when the bars are already of length 4 ;;filter-repeat 1 is doing nothing either (setf loopbars2 (omn-to-measure (loop for bar in exo collect (rnd-order bar :type :pitch :seed 8)) 4/4)) Jesper Quote
david Posted August 6, 2024 Author Posted August 6, 2024 you are right, I have already cut my bar in 2/4...sorry I have trouble with English, I start again. here it is in 4/4, does my code work, rigth? I fixed a detail in loopbars (setf exo1 '((e c4 e4 g4 a4 e4 g4 bb4 c5)(f4 a4 c5 d5 fs4 a4 c5 eb5)(g4 a4 c5 e5 -h)(e a4 g4 e4 c4 c5 bb4 g4 e4)( d5 c5 a4 f4 eb5 c5 a4 fs4)(e5 c5 a4 g4 -h)(e c4 e4 g4 a4 c5 bb4 g4 e4)( f4 a4 c5 d5 eb5 c5 a4 fs4)( g4 a4 c5 e5 -h)(e a4 g4 e4 c4 e4 g4 bb4 c5)( d5 c5 a4 f4 fs4 a4 c5 eb5)( e5 c5 a4 g4 -h))) (setf loopbars (omn-to-measure (loop for bar in exo1 collect ;;or append (list (filter-repeat 1 (rnd-order (first (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch) (filter-repeat 1 (rnd-order (second (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch))) 4/4)) => Quote
david Posted August 6, 2024 Author Posted August 6, 2024 exo1 is handwritten, bars 1 to 3 being the original retrograde and inversion if you look closely my seed 3 corresponds to exo1. (setf exo1 '((e c4 e4 g4 a4 e4 g4 bb4 c5)(f4 a4 c5 d5 fs4 a4 c5 eb5)(g4 a4 c5 e5 -h)(e a4 g4 e4 c4 c5 bb4 g4 e4)( d5 c5 a4 f4 eb5 c5 a4 fs4)(e5 c5 a4 g4 -h)(e c4 e4 g4 a4 c5 bb4 g4 e4)( f4 a4 c5 d5 eb5 c5 a4 fs4)( g4 a4 c5 e5 -h)(e a4 g4 e4 c4 e4 g4 bb4 c5)( d5 c5 a4 f4 fs4 a4 c5 eb5)( e5 c5 a4 g4 -h))) what interests me is to find the results of bars 4, 5 and 6 then 7, 8 and 9 and 10, 11 and 12 from a seed is it possible? (setf loopbars (omn-to-measure (loop for bar in exo1 collect ;;or append (list (filter-repeat 1 (rnd-order (first (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch) (filter-repeat 1 (rnd-order (second (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch))) 4/4)) Thanks for your help Quote
jesele Posted August 6, 2024 Posted August 6, 2024 The result of loopbars with seed 3 is the same as exo1, no? This is basically doing the same thing, the seed behaving a bit differently when using rnd-order on the two half bars at once (setf loopbars2 (loop for bar in exo1 collect (flatten (rnd-order (gen-divide 4 bar) :type :pitch :seed 3)))) Jesper Quote
david Posted August 6, 2024 Author Posted August 6, 2024 you removed filter-repeat! with this code it's ok. (setf loopbars (omn-to-measure (loop for bar in exo1 collect ;;or append (list (filter-repeat 1 (rnd-order (first (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch) (filter-repeat 1 (rnd-order (second (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch))) 4/4)) (filter-repeat 1 (rnd-order (first (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch) (filter-repeat 1 (rnd-order (second (gen-divide 4 bar)) :type :pitch :seed 3) :type :pitch)) Quote
jesele Posted August 6, 2024 Posted August 6, 2024 23 minutes ago, david said: what interests me is to find the results of bars 4, 5 and 6 then 7, 8 and 9 and 10, 11 and 12 from a seed is it possible? Not easily I think. I still don't understand why? You want to use random to generate a result you already have. Jesper Filter-repeat 1 isn't doing anything Quote
david Posted August 6, 2024 Author Posted August 6, 2024 No, I want to generate content that I think is interesting. 2 minutes ago, jesele said: Not easily I think. I still don't understand why? I wrote it by hand, I wish OM would find the results from my first 3 bars starting line (setf exo1 '((e c4 e4 g4 a4 e4 g4 bb4 c5)(f4 a4 c5 d5 fs4 a4 c5 eb5)(g4 a4 c5 e5 -h))) Quote
jesele Posted August 6, 2024 Posted August 6, 2024 Maybe have a look at gen-retrograde instead of rnd-order since it's just combinations of retrograding the whole bar or the first or second half of the bar. Jesper Quote
jesele Posted August 6, 2024 Posted August 6, 2024 ;;need the length in each bar (setf exo2 '((e c4 e4 g4 a4 e4 g4 bb4 c5) (e f4 a4 c5 d5 fs4 a4 c5 eb5) (e g4 a4 c5 e5 -h) (e a4 g4 e4 c4 c5 bb4 g4 e4) (e d5 c5 a4 f4 eb5 c5 a4 fs4) (e e5 c5 a4 g4 -h) (e c4 e4 g4 a4 c5 bb4 g4 e4) (e f4 a4 c5 d5 eb5 c5 a4 fs4) (e g4 a4 c5 e5 -h) (e a4 g4 e4 c4 e4 g4 bb4 c5) (e d5 c5 a4 f4 fs4 a4 c5 eb5) (e e5 c5 a4 g4 -h))) (setf result1 (loop for bar in exo2 collect (gen-retrograde bar))) (setf result2 (loop for bar in exo2 collect (list (first (gen-divide 4 bar)) (gen-retrograde (second (gen-divide 4 bar)))))) (setf result3 (loop for bar in exo2 collect (list (gen-retrograde (first (gen-divide 4 bar))) (second (gen-divide 4 bar))))) Jesper ;;;or as a function (defun foo (lst &optional (type :pp)) (loop with div = nil for bar in lst do (setf div (gen-divide 4 bar)) collect (case type (:rr (gen-retrograde bar)) (:pr (list (first div) (gen-retrograde (second div)))) (:rp (list (gen-retrograde (first div)) (second div))) (t bar))) ) (foo exo2 :rr) (foo exo2 :pr) (foo exo2 :rp) Quote
david Posted August 6, 2024 Author Posted August 6, 2024 I would never have found the code alone, thank you Jesper! surprisingly we don't get the same thing... I found something at my level;-) (setf exo '((e c4 e4 g4 a4)(e4 g4 bb4 c5)(f4 a4 c5 d5)(fs4 a4 c5 eb5)(g4 a4 c5 e5)( -h)(e a4 g4 e4 c4)( c5 bb4 g4 e4)( d5 c5 a4 f4)(eb5 c5 a4 fs4)(e5 c5 a4 g4)( -h)(e c4 e4 g4 a4)( c5 bb4 g4 e4)( f4 a4 c5 d5)( eb5 c5 a4 fs4)( g4 a4 c5 e5)( -h)(e a4 g4 e4 c4)( e4 g4 bb4 c5)( d5 c5 a4 f4)( fs4 a4 c5 eb5)( e5 c5 a4 g4)( -h))) (setf r2/1 (do-section '(x -) '(gen-retrograde x) exo)) (setf r2/1a (do-section '(- x) '(gen-retrograde x) r2/1)) (setf r1/2 (do-section '(- x) '(gen-retrograde x) exo)) (setf free (rnd-order exo :type :pitch)) exact copy of exo. which means if I take the first 6 bars I get what I was looking for with functions and without writing the result by hand...which takes a lot more time for me;-) the basic idea! (setf exo2 '((e c4 e4 g4 a4)( e4 g4 bb4 c5)(f4 a4 c5 d5)( fs4 a4 c5 eb5)(g4 a4 c5 e5)( -h))) (setf r2/1 (do-section '(x -) '(gen-retrograde x) exo2)) (setf r2/1a (do-section '(- x) '(gen-retrograde x) r2/1)) (setf r1/2 (do-section '(- x) '(gen-retrograde x) exo2)) (setf free (rnd-order exo2 :type :pitch)) Quote
david Posted August 6, 2024 Author Posted August 6, 2024 This software is way too complex for the basics I'm trying to do...;-) Quote
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.