AM Posted April 9, 2022 Share Posted April 9, 2022 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)) JulioHerrlein, o_e, Stephane Boussuge and 1 other 4 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted April 9, 2022 Share Posted April 9, 2022 Lovely idea ! Eduardo Reck Miranda was born in my city, Porto Alegre / Brasil ! Best ! https://www.exxoshost.co.uk/atari/mirror/myatari/issues/jul2002/camus.htm AM 1 Quote Link to comment Share on other sites More sharing options...
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.