Jump to content

multi-gen-sort


Recommended Posts

have fun...

greetings

andré

 

;;; here is a MULTI-GEN-SORT -------------------------
;;; you could interlace different processes of SORTING


(defun multi-gen-sort (lists &key (types nil) (sorts '>)  (steps nil) (seed nil))
  (let* ((sorted-lists (loop 
                        for i in lists
                        for cnt = 0 then (incf cnt)
                        collect (gen-sort i 
                                          :type (if (listp types)
                                                  (nth cnt types)
                                                  types)
                                          :sort (if (listp sorts)
                                                  (nth cnt sorts)
                                                  sorts)
                                          :step (if (listp steps)
                                                  (nth cnt steps)
                                                  steps)
                                          :seed seed))))

    (flatten (loop repeat (find-max (loop for i in sorted-lists collect (length i)))
               for cnt = 0 then (incf cnt)
               collect (loop for i in (reverse sorted-lists)
                         collect (nth cnt i))))))
    

;;; some examples


(pitch-list-plot
 (flatten 
  (multi-gen-sort (list (expand-tonality '(c5 'chromatic)) 
                        (expand-tonality '(c3 'chromatic))
                        (expand-tonality '(c4 'chromatic))
                        (expand-tonality '(c6 'chromatic)))
                  :types '(selection insertion min-max selection)
                  :sorts '(> > > >)
                  :steps '(7 6 7 3)))
 :join-points t :point-radius 0 :style :fill)


(pitch-list-plot
 (flatten 
  (multi-gen-sort (list (rnd-order (expand-tonality '(c5 'chromatic))) 
                        (rnd-order (expand-tonality '(c3 'chromatic)))
                        (rnd-order (expand-tonality '(c6 'chromatic)))
                        (rnd-order (expand-tonality '(c4 'chromatic))))
                  :types '(insertion selection min-max selection)
                  :sorts '(> < < >)
                  :steps '(5 3 7 nil)))
 :join-points t :point-radius 0 :style :fill)



(pitch-list-plot
 (flatten 
  (multi-gen-sort (list (rnd-order (expand-tonality '(c6 'chromatic))) 
                        (rnd-order (expand-tonality '(c5 'chromatic)))
                        (rnd-order (expand-tonality '(c4 'chromatic)))
                        (rnd-order (expand-tonality '(c3 'chromatic))))
                  :types '(selection nil insertion min-max)
                  :sorts '(< > < >)
                  :steps '(4 4 4 4)))
 :join-points t :point-radius 0 :style :fill)



(pitch-list-plot
 (filter-repeat 1
                (flatten 
                 
                 (multi-gen-sort (list (rnd-order (expand-tonality '(c4 'chromatic))) 
                                       (rnd-order (expand-tonality '(cs4 'chromatic)))
                                       (rnd-order (expand-tonality '(d4 'chromatic)))
                                       (rnd-order (expand-tonality '(ds4 'chromatic))))
                                 :types '(insertion selection min-max selection)
                                 :sorts '(> < > <)
                                 :steps '(5 5 5 5))))
                :join-points t :point-radius 0 :style :fill)

                                   
                                   
;;; a SORT2 :-)

(pitch-list-plot
 (flatten 
  (gen-sort
   (flatten 
    (multi-gen-sort (list (rnd-order (expand-tonality '(c6 'chromatic))) 
                          (rnd-order (expand-tonality '(c5 'chromatic)))
                          (rnd-order (expand-tonality '(c4 'chromatic)))
                          (rnd-order (expand-tonality '(c3 'chromatic))))
                    :types '(selection nil insertion min-max)
                    :sorts '(< > > >)
                    :steps '(3 3 3 3)))
   :type 'insertion
   :step 7
   :sort '>))
 :join-points t :point-radius 0 :style :fill)

 

some examples:

 

exp1.jpeg

 

exp2.jpeg

 

exp4.jpeg

 

 

 

a sorted mulit-gen-sort:

 

exp3.jpeg

 

 

Link to comment
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.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy