Jump to content

Featured Replies

Posted

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

 

 

 

 

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

  • Author

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 😉

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

  • Author

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

 

=>

image.png.0e1f54d821821878d9a428e46df7e857.png

  • Author

exo1 is handwritten, bars 1 to 3 being the original 

image.png.4ec96b6f5fe2914118bddd6685da5c2f.png

retrograde and inversion

image.png.97f8eb74d54b097205357a515488ae3b.png


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

 

 

 

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

  • Author

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) 

image.png.3b4031df827848b11bf1199785e8cdd2.png

 (filter-repeat 1 (rnd-order (second (gen-divide 4 bar))
               :type :pitch :seed 3) :type :pitch))

 

 

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

 

 

  • Author

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

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

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

 

  • Author

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

Perfect, glad to hear it.

 

Jesper

  • Author

This software is way too complex for the basics I'm trying to do...;-)

 

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