Jump to content

mapping a 2d-field to chords


Recommended Posts

here is a function to MAP a 2d-field to chords (via intervals) // an idea i got from "Nierhaus - Algorithmic Composition" - Cellular Automata (p. 198). so you can "import/map" some GAME-OF-LIFE configurations or whatelse (a pixel photo?)  // the PITCH-MAPPING is like in Miranda's CAMUS.

 

 

;; FUNCTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun 2d-field-to-chord (matrix &key (start 'c4) (merge-chords nil))
  (let* ((int-horizontal
         (x+b (loop for x in (loop for i in matrix 
                               collect (position-item 1 i))
                when (not (null x))
                collect x)
              1))
  
        (int-vertical
         (x+b (loop repeat (length matrix)
                for n = 0 then (incf n)
                
                when (not (null (position-item 1 (nth n matrix))))
                collect n)
              1))

        (chords (loop 
                  for h in int-horizontal
                  for v in int-vertical
                  append (loop for z in h
                           collect (chordize (interval-to-pitch (list z v) :start start))))))

    (if (null merge-chords)
      chords
      (chord-pitch-unique (chordize (flatten chords))))))




;; interval-matrix ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; numbers are intervals (inverted order then in the book)
;; (different sizes are possible)

(setf matrix 
              #|1 2 3 4 5 6 7 8 9 etc..|#

       #|1|# '((1 0 0 0 0 0 0 0 0 0 0 0) 
       #|2|#   (0 1 0 0 0 0 0 0 0 0 0 0) 
       #|3|#   (0 0 1 0 0 0 0 0 0 0 0 0) 
       #|4|#   (0 0 0 0 0 0 0 0 0 0 0 0) 
       #|5|#   (0 0 0 0 0 0 0 0 0 0 0 0) 
       #|6|#   (0 0 0 0 0 0 0 0 0 0 0 0)
       #|7|#   (0 0 0 0 0 0 0 0 0 0 0 0)
   #|etc..|#   (0 0 0 0 0 0 0 0 0 0 0 0)
               (0 0 0 0 0 0 0 0 1 0 0 0)
               (0 0 0 0 0 0 0 0 0 0 0 0)
               (0 0 0 0 0 1 0 0 0 0 0 0)
               (0 0 0 0 0 0 0 0 0 0 0 0)))
      
              
(2d-field-to-chord matrix)
(2d-field-to-chord matrix :start 'd4)
(2d-field-to-chord matrix :merge-chords t)
(2d-field-to-chord matrix :merge-chords t :start 'd4)

;; as a scale
(sort-asc (melodize (2d-field-to-chord matrix :merge-chords t)))


;; with rnd-generated field (by probability)

(progn
  (setf matrix (loop repeat 32
                 collect (loop repeat 32 
                           collect (prob-pick '((0 0.97) (1 0.03))))))
  (2d-field-to-chord matrix))

(progn
  (setf matrix (loop repeat 32
                 collect (loop repeat 32 
                           collect (prob-pick '((0 0.99) (1 0.01))))))
  (2d-field-to-chord matrix :merge-chords t))

 

IMG_2723.thumb.jpg.1baf02361f7661b675b67b37ef809dd7.jpg

 

 

 

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