Jump to content
Sign in to follow this  
Yuichi Yamamoto

Recurrent Evaluation of Music

Recommended Posts

Hi, I'm Yuichi.

I don't know if there was anyone else who already did similar things or not, but I would like to share the way I achieved the continuously self-evaluating program. I actually made a video of it and hopefully I can post it here but I'll paste the code down here anyway, too.

 

CODE

wrap the whole music with a function named "evalAll (better name should be applied):

(defun evalAll ()
(setf pitch (integer-to-pitch (rnd-row)))
(setf len (span pitch '(s)))
(setf omn (make-omn :pitch pitch :length len))
(def-score 12-tone
           (:key-signature 'atonal
            :time-signature '(4 3)
            :tempo 120)
(inst :omn omn))
(display-musicxml '12-tone)
(display-midi '12-tone)
(sleep 1.5)
(evalAll)
)

(evalAll)

 

This is just a tiny fragment of music so I'm not going to discuss the music but you see the difference between this and "live-coding-midi".

In each loop it re-evaluates itself: meaning if there is random things, it will get each different results.

Note that this is an infinite loop so in order to stop this, you have to press "command" + ",".

If you don't like the program to freeze while executing this program, there is a way.

Thanks to the developers for adding bordeaux-threads in the recent update, you can have multi-threads in Opusmodus now, so if you just make a thread of this recurrent program alone you won't be bothered to be stopped anymore.
And extending this idea will lead you to have one recurrent program running while you can freely change some variables(maybe scales / chords/ instruments/ whatever) and it will be, right-on-time, reflected to the music.


I hope this will inspire somebody's imagination.

 

Yuichi

 

recurrent.mp4

Share this post


Link to post
Share on other sites

hi yuichi

 

here a version without exit-problems... a simple loop (with x-generations), that's what your code is doing... so you don't have to re-evaluate, loop is doing this...

(setf generations 20)
(setf omn (loop repeat generations
            do (setf pitch (integer-to-pitch (rnd-row)))
            do (setf len (span pitch '(s)))
            collect (make-omn :pitch pitch :length len)))

(def-score 12-tone
           (:key-signature 'atonal
                           :time-signature '(4 4)
                           :tempo 120)
  (inst :omn omn))
(display-musicxml '12-tone)
(display-midi '12-tone)

 

 

 

Share this post


Link to post
Share on other sites
;;; i think what you are looking for is something like that:
;;; in every generation the sequence will be new, and at some 
;;; points (when sample-length = 1) the row is changing...


(setf generations 200)
(setf omn (loop repeat generations
            with seq = (rnd-row)
            do (setf pitch (integer-to-pitch (setf seq (rnd-sample-seq (1+ (random (length seq))) seq)))) ;; picks a rnd-length-sample of the row
            
            ;; when the random-chosen seq-length = 1 then a new row will be generated but ONE value shorter
            ;; (see: (butlast (rnd-row)) , so the feedback will come quicker and quicker... because
			;; of the chance to match  seq-length = 1
     
			when (= (length seq) 1) do (setq seq (butlast (rnd-row))) ;;  the feedback on production
            do (setf len (span pitch '(s)))
            collect (make-omn :pitch pitch :length len)))
      

(def-score 12-tone
           (:key-signature 'atonal
                           :time-signature '(4 4)
                           :tempo 120)
  (inst :omn omn))
(display-musicxml '12-tone)
(display-midi '12-tone)

;;;

 

Share this post


Link to post
Share on other sites

for further ideas: i think it's a good solution to work with "structures" = "datasets" and a "machine" who generates output based on these datas.

 

... your "machine" will pick its rules/datas... from there, so you have good possibilties to work with more then one dataset, and give also a feedback on this sets (such a dataset is like a "GENOM", and the machine produces its outputs based on this "GENOM" but also influences it = feeback)...

 

an dataset-example from my current project...

;;; defines a  structure called  CHORDSET

(defstruct chordset 
  name
  interval-seq
  interval-direction
  startpitch
  durations
  rhy
  velocity
  cresc-dim
  seq-length
  rotate-dynmics
  sampling-types
  form-types
  data1)

;;;  VARIABLE CHORD1 will be  "filled" with datas in this structure -> see "make-chordset"

(setf chord1 
      (make-chordset
       :name 'chord1
       :interval-seq '(3 5 3 3 5 3 3 5 3 3)
       :interval-direction '((up 0.5) (down 0.5))
       :startpitch '(c4 gs4)
       :durations '1
       :rhy '((1/32 0.4) (1/20 0.4) (1/12 0.2))
       :velocity (weighted-random '(((pppp ppp pp p mp mf mp p pp ppp pppp) 0.5)
                                    ((p p p mp mp mf mp mp p p p) 0.5)))
       :cresc-dim '(pppp p)
       :seq-length '((3 0.3) (5 0.3) (7 0.1) (11 0.3))
       :form-types '(crippled asymmetric symmetric broken)
       :sampling-types '(rnd from-center)))


;;; every  data could be read by (for example)
	(chordset-startpitch chord1)
	=>  (c4 gs4)
;;; or could be rewritten by
	(setf (chordset-startpitch chord1) 'c3)
;;; then:
	(chordset-startpitch chord1)
	=>  c3

 

=> the machine reads this self-definied datas and generating output (like YOUR program)

=> an perhaps when some patterns are recognized (in the production-process) there could be an influence on the dataset

     -> rewrite the dataset

 

=> that's a way to control and design such recursiv-production-systems, but there are also many other ways...

 

i hope that helps you - and i hope i did not misunderstand  your ideas/code...

regards

andré 

Share this post


Link to post
Share on other sites

Another example (a score example) of using a loop for generate some multiple output of a process.

 

;;; FORME ETRANGE
;;; POUR PIANO SEUL.

(setf row '(c4 e4 g4 bb4 d5 fs5 a5 gs5 f5 eb4 cs4 b4))
(setf set1 (subseq row 0 6))
(setf set2 (subseq row 3 9))
(setf set3 (subseq row 6 12))

(setf couleur1 (gen-chord 12 5 5 -6 6 (gen-repeat 12 set1)))
(setf couleur2 (gen-chord 12 5 5 -6 6 (gen-repeat 12 set2)))
(setf couleur3 (gen-chord 12 5 5 -6 6 (gen-repeat 12 set3)))

(setf path1 (tonality-series couleur1))
(setf path2 (tonality-series couleur2))
(setf path3 (tonality-series couleur3))

;;;=============================================

(setf ch1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop 
          24
          (make-omn 
          :pitch (rnd-sample 6 couleur1)
          :length (rnd-sample 1 '((q h -q)
                                  (h h)
                                  (e e e e h)
                                  (w)
                                  (q q)
                                  (q e e q)
                                  (q -q)
                                  ))
          :velocity (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))                      
          ))))))
          
(setf un1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (pitch-transpose -48 (rnd-sample 1 (melodize (rnd-sample 1 couleur1))))
            :length (rnd-sample 1 '((h -q)
                                    (w)
                                    (q -h)
                                    ))
            :velocity '((ffff))
            ))))))

(setf ar1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (pitch-transpose 
                    (rnd-pick '(10 11 12 13 14 15 16 17))
                    (tonality-map (rnd-sample 1 path1) 
                                  (rnd-sample 1 '(
                                                  (c2 e2 g2 b2 d3 fs3 c4 e4 g4 b4 d5 fs5)
                                                  (c2 e2 g2 b2 d3 fs3 d3 fs3 a4 e5 b5)
                                                  (fs5 d5 b4 g4 e4 c4 b4 g4 e4 c4 b3 g3 e3 c3)
                                                  (fs5 d5 b4 d5 b4 g4 b4 g4 e4 g4 e4 c4 g3 c3)
                                                  ))))
            :length (rnd-sample 1 '((t t t t t q -q)
                                    (t t t t t t t t t t t t)
                                    (s s s s s s s s)
                                    (t t t t t t e e q -q)))
            :velocity  (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))
            ))))))

(setf ar1b (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (filter-repeat 
                    1
                    (pitch-transpose 
                     12
                     (tonality-map 
                      (rnd-sample 1 path1) 
                      (rnd-sample 6 '(c4 d4 e4 f4 g4 a4 b4 c5 d5 e4 fs5)))))
            :length (rnd-sample 1 '((t t t t t q -q)
                                    (t t t t t t t t t t t t)
                                    (s s s s s s s s)
                                    (t t t t t t e e q -q)))
            :velocity  (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))
            ))))))

;; Assemblage

(setf s1 (rnd-sample 24 (append ch1 un1 ar1 ar1b)))

;;;==========================================
(setf ch1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop 
          24
          (make-omn 
          :pitch (rnd-sample 6 couleur2)
          :length (rnd-sample 1 '((q h -q)
                                  (h h)
                                  (e e e e h)
                                  (w)
                                  (q q)
                                  (q e e q)
                                  (q -q)
                                  ))
          :velocity (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))                      
          ))))))
          
(setf un1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (pitch-transpose -48 (rnd-sample 1 (melodize (rnd-sample 1 couleur2))))
            :length (rnd-sample 1 '((h -q)
                                    (w)
                                    (q -h)
                                    ))
            :velocity '((ffff))
            ))))))

(setf ar1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (pitch-transpose 
                    (rnd-pick '(10 11 12 13 14 15 16 17))
                    (tonality-map (rnd-sample 1 path2) 
                                  (rnd-sample 1 '(
                                                  (c2 e2 g2 b2 d3 fs3 c4 e4 g4 b4 d5 fs5)
                                                  (c2 e2 g2 b2 d3 fs3 d3 fs3 a4 e5 b5)
                                                  (fs5 d5 b4 g4 e4 c4 b4 g4 e4 c4 b3 g3 e3 c3)
                                                  (fs5 d5 b4 d5 b4 g4 b4 g4 e4 g4 e4 c4 g3 c3)
                                                  ))))
            :length (rnd-sample 1 '((t t t t t q -q)
                                    (t t t t t t t t t t t t)
                                    (s s s s s s s s)
                                    (t t t t t t e e q -q)))
            :velocity  (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))
            ))))))

(setf ar1b (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (filter-repeat 
                    1
                    (pitch-transpose 
                     12
                     (tonality-map 
                      (rnd-sample 1 path2) 
                      (rnd-sample 6 '(c4 d4 e4 f4 g4 a4 b4 c5 d5 e4 fs5)))))
            :length (rnd-sample 1 '((t t t t t q -q)
                                    (t t t t t t t t t t t t)
                                    (s s s s s s s s)
                                    (t t t t t t e e q -q)))
            :velocity  (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))
            ))))))

;; Assemblage

(setf s2 (rnd-sample 24 (append ch1 un1 ar1 ar1b)))

;;;==========================================

(setf ch1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn 
          :pitch (rnd-sample 6 couleur3)
          :length (rnd-sample 1 '((q h -q)
                                  (h h)
                                  (e e e e h)
                                  (w)
                                  (q q)
                                  (q e e q)
                                  (q -q)
                                  ))
          :velocity (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))                      
          ))))))
          
(setf un1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (pitch-transpose -48 (rnd-sample 1 (melodize (rnd-sample 1 couleur3))))
            :length (rnd-sample 1 '((h -q)
                                    (w)
                                    (q -h)
                                    ))
            :velocity '((ffff))
            ))))))

(setf ar1 (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (pitch-transpose 
                    (rnd-pick '(10 11 12 13 14 15 16 17))
                    (tonality-map (rnd-sample 1 path3) 
                                  (rnd-sample 1 '(
                                                  (c2 e2 g2 b2 d3 fs3 c4 e4 g4 b4 d5 fs5)
                                                  (c2 e2 g2 b2 d3 fs3 d3 fs3 a4 e5 b5)
                                                  (fs5 d5 b4 g4 e4 c4 b4 g4 e4 c4 b3 g3 e3 c3)
                                                  (fs5 d5 b4 d5 b4 g4 b4 g4 e4 g4 e4 c4 g3 c3)
                                                  ))))
            :length (rnd-sample 1 '((t t t t t q -q)
                                    (t t t t t t t t t t t t)
                                    (s s s s s s s s)
                                    (t t t t t t e e q -q)))
            :velocity  (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))
            ))))))

(setf ar1b (mclist (position-insert
           '(0)
           '(ped)
           (assemble-seq (gen-loop
          24
          (make-omn
            :pitch (filter-repeat 
                    1
                    (pitch-transpose 
                     12
                     (tonality-map 
                      (rnd-sample 1 path3) 
                      (rnd-sample 6 '(c4 d4 e4 f4 g4 a4 b4 c5 d5 e4 fs5)))))
            :length (rnd-sample 1 '((t t t t t q -q)
                                    (t t t t t t t t t t t t)
                                    (s s s s s s s s)
                                    (t t t t t t e e q -q)))
            :velocity  (rnd-sample 1 '((f)(ff)(fff)(mf)(mp)(p)(pp)))
            ))))))

;; Assemblage

(setf s3 (rnd-sample 24 (append ch1 un1 ar1 ar1b)))

(def-score FormeEtrange-s1
           (
            :title "FormeEtrange"
            :composer "S.Boussuge"
            :copyright "Copyright © 2014 S.Boussuge"
            :key-signature 'chromatic
            :time-signature (get-time-signature s1)
            :tempo 108
            :layout (piano-grand-layout 'piano)
            )

(piano
 :omn s1
 :channel 1
 :sound 'gm
 :program 'acoustic-grand-piano
 ;:port 0
 )
)

(def-score FormeEtrange-s2
           (
            :title "FormeEtrange"
            :composer "S.Boussuge"
            :copyright "Copyright © 2014 S.Boussuge"
            :key-signature 'chromatic
            :time-signature (get-time-signature s2)
            :tempo 108
            :layout (piano-grand-layout 'piano)
            )

(piano
 :omn s2
 :channel 1
 :sound 'gm
 :program 'acoustic-grand-piano
 ;:port 0
 )
)

(def-score FormeEtrange-s3
           (
            :title "FormeEtrange"
            :composer "S.Boussuge"
            :copyright "Copyright © 2014 S.Boussuge"
            :key-signature 'chromatic
            :time-signature (get-time-signature s3)
            :tempo 108
            :layout (piano-grand-layout 'piano)
            )

(piano
 :omn s3
 :channel 1
 :sound 'gm
 :program 'acoustic-grand-piano
 ;:port 0
 )
)

(compile-score '(
                 FormeEtrange-s1
                 FormeEtrange-s2
                 FormeEtrange-s3
                 ))

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Topics

    • By torstenanders
      Common Music (CM) is another interesting composition system (http://commonmusic.sourceforge.net), and a recent revision of the old CM version 2 (https://github.com/ormf/cm), which was still implemented in Common Lisp (in contrast to later versions defined in Scheme) can be loaded into and used alongside Opusmodus 1.2 without problems. This was possible primarily due to a largely revised load mechanism of the old CM sources.  
       
      With the new Opusmodus 1.3 this is not possible any more. It seems the problem is caused by the fact that :CLM (and a number of variants) are still added to *features*, but there is no CLM package anymore. I cannot see the Opusmodus sources, but I assume that all CLM definitions have been added directly to the Opusmodus package. Anyway, due to the present feature CM assumes that CLM is there, but then cannot find its package. 
       
      Anyway, I found a way around (by changing the relevant feature expressions from #-clm into #-(and clm (not opusmodus)) and will try to have that included in the relevant CM sources at https://github.com/ormf/cm
       
      Best,
      Torsten
       
    • By Andy
      I have converted many of my scores made in Notion to music xml in order to display them in the Assistant..which is very nice indeed.
       
      I'm wondering if I can convert those xml scores to an Opusmodus score direct or do I have to re-import them as midi? I see I can go the other way..xml to Notion, but cannot find how to go this way or if it's possible.
       
      Thanks
    • By PatrickMimran
      Hi Everybody 
       
      I found a great app to upload and share your music here is the address you can test it it is much better and classy than Soundcloud 
       
      https://octave.is/pmimran/privatealbum/patrick%40mimran.com/em2XkPshTa
       
      Patrick Mimran
×
×
  • Create New...