Jump to content

AM

core_group_3
  • Content Count

    515
  • Joined

  • Last visited

  • Days Won

    108

Everything posted by AM

  1. a "rnd-pick" that works with different "input-formats"... so it's flexible to use... for many (not all) input-cases ;;; subfunction (defun weighted-random (list) (loop for item in list with rand-num = (random (loop for x in list sum (second x))) for add = (second item) then (+ add (second item)) when (< rand-num add) return (first item))) ;;; mainfunction (defun rnd-pick* (alist) (if (and (listp (first alist)) (floatp (second (first alist)))) (weighted-random alist) (rnd-pick alist))) ;;; examples ;;; without weight (rnd-pick* '(1 2 3 4 5)) (rnd-pick* '((1 2 3 4) (3 4 5 7 3) (75 392 2))) ;;; with weight (rnd-pick* '((2 0.2) (3 0.4) (4 0.2))) (rnd-pick* '(((2 3 4 5) 0.2) ((8 796 5) 0.4))) (rnd-pick* '(((1 3) 0.2) (3 0.3)))
  2. not the same number of pitches/rhythms, like phase-shifted
  3. ;;; ----------------------------------------------------------------------------------------------- ;;; A QUASI-UNISONO by proportional length-differences ;;; SAME PITCHES IN ALL VOICES INCLUDING START/END-PITCH ;;; ----------------------------------------------------------------------------------------------- ;;; a random-pitch-seq (rnd-walk) ;;; ;;; immediate-pitch-repetitions are building the rhythm ;;; ;;; with MODIFY-PROPORTIONS i'm generating "proportional variants" of this rhythm, in this example ;;; by 16 generations -> then i take the generations 1, 8, and 15 for each voice ;;; ;;; by "(filter-repeat 1 sequence)" i swallow the immediate-pitch-repetitions for correct ;;; of PITCH- and RHYTHM-phases ;;; ;;; ----------------------------------------------------------------------------------------------- ;;; FUNCTION (defun modify-proportions (n prop-list &key (style 'sharpen)) (let ((rest-pos (loop for i in prop-list for cnt = 0 then (incf cnt) when (< i 0) collect cnt)) (prop-list (abs! prop-list)) (liste)) (progn (setf liste (append (list prop-list) (loop repeat n when (or (= (length (find-above 1 prop-list)) 1) (= (length (find-unique prop-list)) 1)) collect prop-list else collect (setf prop-list (loop for i in prop-list for cnt = 0 then (incf cnt) collect (cond ((= cnt (position (find-closest 2 (find-above 1 prop-list)) prop-list)) (if (equal style 'sharpen) (1- i) (1+ i))) ((= cnt (position (find-max prop-list) prop-list)) (if (equal style 'sharpen) (1+ i) (1- i))) (t i))))))) (loop for i in liste collect (loop for k in i for cnt = 0 then (incf cnt) when (memberp cnt rest-pos) collect (* -1 k) else collect k))))) ;;; ----------------------------------------------------------------------------------------------- ;;; GENERATING SCORE (setf sequence (gen-walk 100 :step '(0 0 0 0 0 0 0 1 2) :start 'c5)) (setf rhy 1/32) ;;; ----------------------------------------------------------------------------------------------- (def-score quasi-unisono (:title "quasi-unisono" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instr1 :omn (make-omn :length (gen-length (nth 1 (modify-proportions 16 (count-repeat sequence) :style 'sharpen)) rhy) :pitch (filter-repeat 1 sequence)) :channel 1 :port 0 :sound 'gm) (instr2 :omn (make-omn :length (gen-length (nth 8 (modify-proportions 16 (count-repeat sequence) :style 'sharpen)) rhy) :pitch (filter-repeat 1 sequence)) :channel 2 :port 0 :sound 'gm) (instr3 :omn (make-omn :length (gen-length (nth 15 (modify-proportions 16 (count-repeat sequence) :style 'sharpen)) rhy) :pitch (filter-repeat 1 sequence)) :channel 3 :port 0 :sound 'gm)) there is no BUG when i work without "omn-to-time-signature", but is also not necessary!
  4. ;;; SWAPS THE POSITIONS SYMMETRICALLY AND RANDOMIZED ;;; n => number of generations, output: last gen or all gens... ;;; new-version works also for symmetrical-sequences! (special cas) (defun rnd-symmetrical-position-swap (n liste &key (out 'all)) (let ((n1) (n2)) (progn (setf liste (loop repeat n do (setf n1 (random (1- (list-length-divide liste))) n2 (random (1- (list-length-divide liste)))) collect (progn (setf liste (position-swap (list (list n1 n2) (list (- (1- (length liste)) n1) (- (1- (length liste)) n2))) liste))))) (cond ((equal out 'last) (car (last liste))) ((equal out 'all) (append liste)))))) (rnd-symmetrical-position-swap 2 '(1 2 3 4 3 2 1) :out 'last) (rnd-symmetrical-position-swap 5 '(1 2 3 4 5 6) :out 'last) (rnd-symmetrical-position-swap 2 '(a b c d e f g h) :out 'all)
  5. AM

    snippet problem?

    thanx! you are fast :-)
  6. AM

    snippet problem?

    when i put these lists into MAKE-OMN, i get strange rhy-values, because MAKE-OMN "organizes" the TIED-values different... why? (make-omn :length '(3q 3q 3q_t -e. t_3q 3q 3q) :pitch '(a5 f5 b4 ds5 a4 f4)) have a look how the rhythm-notation changed (3q a5 f5 s_t_3s b4 -e. s_t_3s ds5 3q a4 f4) thanks a.
  7. AM

    snippet problem?

    perfect! i thought it was something like that - it seems that it's strange with "every TIE" in such a combination... also with: (5q 5q 5h._3q -3q 3q_5h. 5q 5q) (t t e._5q -5h. 5q_e. t t) etc... thanks! a.
  8. AM

    modify-proportions

    ;;; ---------------------------------------------------------------- ;;; modifying proprtions by add/sub of the smallest/largest values ;;; number of elements is constant / sum of the seq also constant ;;; n => number of generations ;;; prop-list => integers ;;; :style => sharpen or flatten ;;; ---------------------------------------------------------------- (defun modify-proportions (n prop-list &key (style 'sharpen)) (let ((rest-pos (loop for i in prop-list for cnt = 0 then (incf cnt) when (< i 0) collect cnt)) (prop-list (abs! prop-list)) (liste)) (progn (setf liste (append (list prop-list) (loop repeat n when (or (= (length (find-above 1 prop-list)) 1) (= (length (find-unique prop-list)) 1)) collect prop-list else collect (setf prop-list (loop for i in prop-list for cnt = 0 then (incf cnt) collect (cond ((= cnt (position (find-closest 2 (find-above 1 prop-list)) prop-list)) (if (equal style 'sharpen) (1- i) (1+ i))) ((= cnt (position (find-max prop-list) prop-list)) (if (equal style 'sharpen) (1+ i) (1- i))) (t i))))))) (loop for i in liste collect (loop for k in i for cnt = 0 then (incf cnt) when (memberp cnt rest-pos) collect (* -1 k) else collect k))))) ;;; examples (modify-proportions 8 '(4 3 -2 7 3 2 7) :style 'sharpen) (modify-proportions 8 '(4 3 -2 7 3 2 7) :style 'flatten) (omn-to-time-signature (gen-length (modify-proportions 8 '(4 3 2 7) :style 'sharpen) 1/16) '(4 4)) (omn-to-time-signature (gen-length (modify-proportions 8 '(4 3 2 7) :style 'flatten) 1/16) '(4 4)) (list-plot (modify-proportions 10 '(5 3 2 -7 1 8 2)) :point-radius 0 :style :fill) ...works not in all CASES (when :style 'flatten), but okay...
  9. ...an idea to manipulate lists of pitches/rhythms by "sampling" ;;; subfunction (defun sampling-list (liste start-position seq-length) (loop repeat seq-length for cnt = start-position then (incf cnt) when (= cnt (length liste)) do (setf cnt 0) collect (nth cnt liste))) ;;; MAIN: ;;; an value-list will be sampled by start-pos-list in the length of seq-length-list (defun structural-interferences (n value-list start-pos-list seq-length-list) (let ((start-pos-list (remove (length value-list) start-pos-list :test #'<))) (loop repeat n for start-pos = 0 then (incf start-pos) for seq-length = 0 then (incf seq-length) when (= start-pos (length start-pos-list)) do (setf start-pos 1) when (= seq-length (length seq-length-list)) do (setf seq-length 0) append (sampling-list value-list (nth start-pos start-pos-list) (nth seq-length seq-length-list))))) ;;something (list-plot (structural-interferences 21 '(1 2 3 4 5) '(0 1 2 3 4 5 6 7 8 9) '(1 3 2 4 1 2 2 3 1 1 1 1)) :point-radius 1 :style :fill) ;;"self-similar" (list-plot (structural-interferences 21 '(3 2 1 5 4 2) '(2 1 0 4 3 1) '(3 2 1 5 4 2)) :point-radius 1 :style :fill)
  10. AM

    get-proportions

    ;;; GETTING THE LENGTH-PROPORTIONS AS INTEGERS (defun get-proportions (omn_seq &key (abs 'nil)) (let ((denoms)) (progn (setf denoms (remove-duplicates (loop for i in (omn :length omn_seq) collect (denominator (abs i))))) (loop for i in (omn :length omn_seq) collect (if (equal abs 't) (* (abs i) (apply 'lcm denoms)) (* i (apply 'lcm denoms))))))) ;; examples (get-proportions '(-3q 3h_h. d3 mf)) (get-proportions '(5q 5q 5q 5q 5q -e -s t t -q)) (get-proportions '(5q 5q 5q 5q 5q -e -s t t -q) :abs t) (get-proportions '(-e -t t t t t t t t t -s. -q)) ;;; HOW TO USE (setf rhy '(-3h 3q_5h. 5q 5q c4)) (setf props (get-proportions rhy :abs nil)) ;;; you can use that for GEN-LENGTH-CONSTANT ;; ordinary (gen-length-constant props 'w.) ;; a bit advanced (gen-length-constant props 'h.) ;; crazy (gen-length-constant props 'h._e)
  11. AM

    pattern-map/match overwriting

    thanx... but seems to be more complicated... i'll try to code/sketch a solution
  12. a question: in a pattern match i would like to overwrite the existing OMN sequence. that means that for the duration of the insert the original OMN-sequence is not pushed backwards. As I see it now, the OMN-values are only inserted and do not overwrite the sequence, (and not rhythmically "compensating") ... ? would be very nice! ...or i have to code it for myself an example: ;; basic omn-seq '(e c4 -e -q q c4 -q s c4 -e. q) ;; insert '(3q c4 d4 e4 c4 d4 e4 c4 d4) ;; pattern-match on (q c4) ;; result should be '(e c4 -e -q 3q c4 d4 e4 c4 d4 e4 c4 d4 -3q q c4)
  13. AM

    structural interferences

    i work in another way... the tools has to follow the ideas and not my ideas are "what the tools can do" ;-)
  14. AM

    microtonality

    release? - would be important for next projects, and many other users :-)
  15. AM

    microtonality

    how is it currently with the support of microtonality (omn & xml-display)? thanks for some informations andré
  16. AM

    structural interferences

    ... i think sometimes i'm faster when i code it for myself then to search in the library :-)
  17. if you want to augm/dim the LENGTH of a special technique... you could use that... or extend it... (defun modify-length-of-a-technique (omn-list &key technique (factor 1) (modification 'augmentation)) (flatten (loop for i in (single-events omn-list) when (equal (car (omn :articulation i)) technique) collect (cond ((equal modification 'augmentation) (length-augmentation factor i)) ((equal modification 'diminution) (length-diminution factor i))) else collect i))) (modify-length-of-a-technique '(q d4 mf ponte e fs4 tasto -e. e g4 tasto q gs4 ponte) :technique 'ponte :factor 10 :modification 'augmentation) ;; also 'diminution
  18. a perfect listing, very clear and useful!
  19. AM

    figured-bass function

    ...except that makes you a fun and makes you happy - and that is just as important! added 10 minutes later so the question will be what can be better, which will be more exciting than what deep learning (or traditional algorithms) can produce. very fast then - in my opinion - the production becomes quite simple and well done, but this has nothing to do with art (if you want) - it will be the "imitation of art", also algorithmic tools pushing you in this direction - is it "music" or the simulation of "music"?. but as VON FOERSTER said: "the map is the territory"... counteracting (radical-constructivistic) the phrase "the map is not the territory"...
  20. AM

    figured-bass function

    critical thought about this: I think in the near future this will work through "deep learning". So it is questionable how useful it is to formalize such manual and traditional "activities", such "complex rules systems" in CODE. this question generally arises in areas that focus on imitating and executing existing styles. greetings andré
  21. AM

    velocity-to-dynamic limitation

    you are brilliant! will it be part of the "official OM", or should i integrate it in my USER LIBRARY? regards andré
  22. AM

    step-to-pitch

    here is a little "sketched" function STEP-TO-PITCH , perhaps OM could further develop the function... ;;; FUNCTION (defun step-to-pitch (&key steps pitches start) (let ((pos (car (position-item start pitches)))) (append (list (nth pos pitches)) (loop for i in steps ;; setting pos by add the step to pos do (setf pos (+ pos i)) ;; when pitch-range to small then reset to lowest pitch+step ;; could be a more intelligent solution when (> pos (length pitches)) do (setf pos (+ 0 i)) collect (nth pos pitches))))) ;;; EXAMPLES (step-to-pitch :steps '(1 1 -1 2 2 -1) :pitches '(c4 d4 e4 f4 g4 a4) :start 'c4) ;; => (c4 d4 e4 d4 f4 a4 g4) (step-to-pitch :steps '(1 1 -1 2 2 -1) :pitches (expand-tonality '(c4 chromatic)) :start 'c4) ;; => (c4 cs4 d4 cs4 ds4 f4 e4) (step-to-pitch :steps '(1 1 -1 2 2 -1 5) :pitches (expand-tonality '(c4 messiaen-mode6)) :start 'c4) ;; => (c4 d4 e4 d4 f4 gs4 fs4 gs4)
  23. the "STEP-TO"-idea could be used more common... with other parameters...welcome to extend/develop it... for mulidimensional/multiparametrical rnd-walks (first example)? :-) ;;; FUNCTION -> same as step-to-pitch (defun reading-list-by-steps (&key steps values start) (let ((pos (car (position-item start values)))) (append (list (nth pos values)) (loop for i in steps do (setf pos (+ pos i)) when (> pos (length values)) do (setf pos (+ 0 i)) collect (nth pos values))))) ;;; EXAMPLES ;;; rnd-walk all parameters (make-omn :length (reading-list-by-steps :steps (gen-walk 4 :start 1) :values '(1/32 2/32 3/32 4/32 5/32 6/32) :start 3/32) :pitch (reading-list-by-steps :steps (gen-walk 4 :start 2) :values (expand-tonality '(b3 messiaen-mode6)) :start 'ds4) :velocity (reading-list-by-steps :steps (gen-walk 4 :start 1) :values '(pppp ppp pp p mp mf f ff fff ffff) :start 'ppp) :articulation (reading-list-by-steps :steps (gen-walk 4 :start 1) :values '(ponte tasto spicc ord pizz snap) :start 'tasto)) ;;;; separeted examples (reading-list-by-steps :steps (gen-walk 4 :start 1) :values '(pppp ppp pp p mp mf f ff fff ffff) :start 'ppp) ;; => depends on rnd-walk values (reading-list-by-steps :steps '(1 1 -1 2 2 -1 1) :values '(a b c d e f g) :start 'b) ;; => (b c d c e g f g) (reading-list-by-steps :steps '(1 1 -1 2 2 -1 1) :values '(1/32 2/32 3/32 4/32 5/32 6/32) :start 3/32) ;; => (3/32 1/8 5/32 1/8 3/16 3/32 1/16 3/32) (reading-list-by-steps :steps '(1 1 -1 2 -1) :values '(ponte tasto spicc ord pizz snap) :start 'tasto) ;; => (tasto spicc ord spicc pizz ord)
  24. AM

    step-to-pitch

    is it also possible to start at a specific pitch? (tonality-step '(c4 d4 e4 g4 a4 f4) '(1 1 -1 2 2 -1) :start 'e4)
×