Jump to content

AM

Members
  • Posts

    793
  • Joined

  • Last visited

Reputation Activity

  1. Like
    AM got a reaction from loopyc in vector-range-drift   
    INPUT-curves could be like that: (in that way you could imitate some early "xenakis-curves" when you map it to pitches :-))
     
    (setf curve1 '(-5.1 -2.3 -1.1 -0.8 -0.3 -2.5)) (setf curve2 '(1.0 1.2 1.5 2.1 4.6 10.6))  
    (vector-range-drift curve1 curve2 (gen-white-noise 250))  
    as result:
     

     
     
     
    "imitated" by my old/simple function:
     
    (list-plot (append (vector-range-drift '(-5.1 1) '(-2.3 1.2) (gen-white-noise 50)) (vector-range-drift '(-2.3 1.2) '(-1.1 1.5) (gen-white-noise 50)) (vector-range-drift '(-1.1 1.5) '(-0.8 2.1) (gen-white-noise 50)) (vector-range-drift '(-0.8 2.1) '(-0.3 4.6) (gen-white-noise 50)) (vector-range-drift '(-0.3 4.6) '(-2.5 10.6) (gen-white-noise 50))))  
     
  2. Like
    AM reacted to opmo in vector-range-drift   
    I will make it that way.
  3. Thanks
    AM got a reaction from loopyc in vector-range-drift   
    (defun vector-range-drift (start end input &key (spread 8)) (let ((values (gen-divide (rnd-sum (length input) (primes spread)) input)) (n-values) (a-step) (b-step)) (progn (setf n-values (1- (length values))) (setf a-step (/ (car (difference (list (car start) (car end)))) n-values)) (setf b-step (/ (car (difference (list (cadr start) (cadr end)))) n-values)) (loop for i in values for a = (car start) then (incf a a-step) for b = (cadr start) then (incf b b-step) append (vector-range a b i))))) ;;;;; EXAMPLES -> MODULATE/DRIFT white-noise - with different spreads (list-plot (vector-range-drift '(-7.1 1) '(-0.1 10) (gen-white-noise 187) :spread 10)) (list-plot (vector-range-drift '(-7.1 1) '(-0.1 10) (gen-white-noise 187) :spread 6)) (list-plot (vector-range-drift '(-7.1 1) '(-0.1 5.6) (gen-white-noise 517))) (list-plot (vector-range-drift '(-1.1 1) '(-3.1 5.6) (gen-white-noise 317)))  
  4. Like
    AM got a reaction from lviklund in vector-range-drift   
    perhaps you could expand the function when we could not only have "start->end-process/linear", also with a seq-curve (two) for LOW and HIGH values... would be very smart. so it's a kind of ambitus-modulation (with perhaps white-noise)
  5. Like
    AM got a reaction from Stephane Boussuge in vector-range-drift   
    (defun vector-range-drift (start end input &key (spread 8)) (let ((values (gen-divide (rnd-sum (length input) (primes spread)) input)) (n-values) (a-step) (b-step)) (progn (setf n-values (1- (length values))) (setf a-step (/ (car (difference (list (car start) (car end)))) n-values)) (setf b-step (/ (car (difference (list (cadr start) (cadr end)))) n-values)) (loop for i in values for a = (car start) then (incf a a-step) for b = (cadr start) then (incf b b-step) append (vector-range a b i))))) ;;;;; EXAMPLES -> MODULATE/DRIFT white-noise - with different spreads (list-plot (vector-range-drift '(-7.1 1) '(-0.1 10) (gen-white-noise 187) :spread 10)) (list-plot (vector-range-drift '(-7.1 1) '(-0.1 10) (gen-white-noise 187) :spread 6)) (list-plot (vector-range-drift '(-7.1 1) '(-0.1 5.6) (gen-white-noise 517))) (list-plot (vector-range-drift '(-1.1 1) '(-3.1 5.6) (gen-white-noise 317)))  
  6. Like
    AM got a reaction from lviklund in find-intervals*   
    function edited - some small changes...
     
    extended:
    :intervals '(1 2 3) -> all these interval-combinations are shown
    or
    :intervals 2 (like before)
     
    new:
    :reduced-interval T or NIL (default NIL) -> when T only basic-intervals search (not 1 = 1 & 13 & 25, only in ONE octave)
     
     
    small example
     
    ;;; SIEVE with SYMM_STRUCTURE (setf sieve1 (pitch-transpose -6 (integer-to-pitch (gen-sieve '((0 39) (0 40)) '((5) (7)))))) (pitch-to-interval sieve1) ;;; search/permutate interval-combinations (setf pitchlist (find-intervals* sieve1 :intervals '(1 2 3) :reduced-interval t :chord nil)) (setf pitchlist (rnd-unique (length pitchlist) pitchlist)) ;;; change direction of the interval-pairs (setf pitchlist (loop for i in pitchlist when (prob? 0.4) collect (reverse i) else collect i)) ;;; remove immediate repetitions (setf pitchlist (filter-repeat 1 (flatten pitchlist))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (def-score sieve-scan (:title "sieve-scan" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :velocity '(p) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
  7. Like
    AM got a reaction from Stephane Boussuge in replace-pitch-by-sequence (with overwrite) - version1   
    here is a first version => replaces a PITCH by a sequence - overwriting the "old seq" - not very easy to CODE/understand how to do it :-)
    take a look an perhaps you have some more/better/extending ideas... a better way to solve the problems?
    greetings
    andré
    ;;; -------------------------------------------------------------------------------------------- ;;; FUNCTIONS ;;; -------------------------------------------------------------------------------------------- (defun get-resolution (seq pattern) (let ((val)) (progn (setq val (loop for i in (single-events seq) when (pattern-matchp i pattern) collect (denominator (car (omn :length i))))) (cond ((memberp (car val) '(3 6 12 24 48)) 1/24) ((memberp (car val) '(2 4 8 16 32)) 1/16) ((memberp (car val) '(5 10 20 40)) 1/20) ((memberp (car val) '(7 14 28 56)) 1/28))))) (defun replace-pitch-by-sequence (seq pitch insert) (let ((resolution (get-resolution seq pitch))) (omn-merge-ties (flatten (loop repeat (length (omn-to-time-signature seq (list (numerator resolution) (denominator resolution)))) for cnt = 0 then (incf cnt) with new-seq = (omn-to-time-signature seq (list (numerator resolution) (denominator resolution))) with insert-rounded = (append insert (rest (length-rational-quantize (list (apply '+ (omn :length insert))) :round resolution))) when (pattern-matchp (nth cnt new-seq) pitch) collect insert-rounded and do (incf cnt (/ (apply '+ (abs! (omn :length insert-rounded))) resolution)) collect (nth cnt new-seq)))))) ;;; -------------------------------------------------------------------------------------------- ;;; EXAMPLES ;;; -------------------------------------------------------------------------------------------- (setf seq '(3q cs5 c5 b4 q c4 d4 e. e4 s f4 h g4)) (setf omn-new (replace-pitch-by-sequence seq (list (rnd-pick (omn :pitch seq))) ;; for tests: takes rnd-pitches (rnd-pick '((t gs5 g5 fs5 f5 e5) ;; for tests: takes rnd-inserts (q gs5 -e e gs5) (3q gs5 tie q gs5) (s gs5 tie q gs5))))) (setf omn-old seq) ;;; -------------------------------------------------------------------------------------------- (def-score test (:title "test" :key-signature 'atonal :time-signature '(4 4) :tempo 90 :layout (bracket-group (treble-layout 'new) (treble-layout 'old))) (new :omn omn-new ;; OMN with iNSERT :channel 1 :port 1 :sound 'gm :program 'acoustic-grand-piano) (old :omn omn-old ;; OMN without iNSERT :channel 1 :port 1 :sound 'gm :program 'acoustic-grand-piano))  
  8. Like
    AM got a reaction from Stephane Boussuge in find-intervals*   
    function edited - some small changes...
     
    extended:
    :intervals '(1 2 3) -> all these interval-combinations are shown
    or
    :intervals 2 (like before)
     
    new:
    :reduced-interval T or NIL (default NIL) -> when T only basic-intervals search (not 1 = 1 & 13 & 25, only in ONE octave)
     
     
    small example
     
    ;;; SIEVE with SYMM_STRUCTURE (setf sieve1 (pitch-transpose -6 (integer-to-pitch (gen-sieve '((0 39) (0 40)) '((5) (7)))))) (pitch-to-interval sieve1) ;;; search/permutate interval-combinations (setf pitchlist (find-intervals* sieve1 :intervals '(1 2 3) :reduced-interval t :chord nil)) (setf pitchlist (rnd-unique (length pitchlist) pitchlist)) ;;; change direction of the interval-pairs (setf pitchlist (loop for i in pitchlist when (prob? 0.4) collect (reverse i) else collect i)) ;;; remove immediate repetitions (setf pitchlist (filter-repeat 1 (flatten pitchlist))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (def-score sieve-scan (:title "sieve-scan" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :velocity '(p) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
  9. Like
    AM got a reaction from Stephane Boussuge in filter-repeat for pairs?   
    is there a possibility to filter some "combinations"?
    when i have a seq like that:
     
    (a4 gs4 a4 gs4 a4 fs4 gs4 g5 bb5 g5 gs4) i want to filter all immediate repetitions with pattern-length = 2
    the result would be:
     
    (a4 gs4 a4 fs4 gs4 g5 bb5 g5 gs4) because a4-gs4 is the pair that repeats
     
     
  10. Like
    AM reacted to opmo in filter-repeat for pairs?   
    Yes, we should have function like that.
  11. Like
    AM got a reaction from opmo in filter-repeat for pairs?   
    is there a possibility to filter some "combinations"?
    when i have a seq like that:
     
    (a4 gs4 a4 gs4 a4 fs4 gs4 g5 bb5 g5 gs4) i want to filter all immediate repetitions with pattern-length = 2
    the result would be:
     
    (a4 gs4 a4 fs4 gs4 g5 bb5 g5 gs4) because a4-gs4 is the pair that repeats
     
     
  12. Like
    AM got a reaction from RST in rnd-walk in a pitchfield with specific interval-control   
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; rnd-walk in a pitchfield - with interval-control ;;; ;;; this is a little function which does an rnd-walk in a special way ;;; the function is checking all possible interval-pairs first inside the pitchfield ;;; so that is on one hand all the time "inside" the pitchfield/sieve, but also only ;;; uses the :POSSIBLE-INTERVALS, so you could control the "interval-color" of the walk ;;; in an non-chromatic-pitchfield/sieve ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun enlarge-intervals (possible-intervals &key (octaves 2)) (let ((possible-intervals (append possible-intervals (loop repeat octaves for i = 12 then (incf i 12) append (x+b possible-intervals i))))) (append possible-intervals (neg! possible-intervals)))) ;(enlarge-intervals '(2 3 4)) ;;;;;;;;;;; (defun special-rnd-walk (n &key pitchfield startpitch possible-intervals (interval-octaves 2)) (let ((int-list (loop for i in pitchfield collect (list (pitch-to-midi i) (loop for x in pitchfield with int do (setf int (car (pitch-to-interval (list i x)))) when (/= int 0) collect int)))) (possible-intervals (enlarge-intervals possible-intervals :octaves interval-octaves))) (append (list startpitch) (midi-to-pitch (loop repeat n with int with pitch = (pitch-to-midi startpitch) do (setf int (rnd-pick (filter-preserve possible-intervals (cadr (assoc pitch int-list))))) when (null int) do (setf int (rnd-pick (cadr (assoc pitch int-list)))) collect (setf pitch (pitch-to-midi (cadr (interval-to-pitch (list int) :start (midi-to-pitch pitch)))))))))) ;;;;;;;;;;; EXAMPLES ;;; rnd-walk in a "chromatic-field" - as the most easiest example/way ;;; => so all possible-intervals could be used -> THE ORDINARY WAY... (special-rnd-walk 20 :startpitch 'cs4 :pitchfield '(gs3 a3 bb3 b3 c4 cs4 d4 ds4 e4 f4 fs4 g4 gs4 a4) :possible-intervals '(1 2 3)) ;;; BUT have a look to the next examples!!! ;;; rnd-walk in a PITCHFIELD -> the function is checking all possible interval-pairs inside the pitchfield ;;; so that the rnd-walk INSIDE the PITCHFIELD could be done with specific intervals (if they are inside the field) ;;; COMPARE THE RESULT with the PITCHFIELD!!! ;;; (setf pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6)) ;;; "interval-color" of the walk is made with :possible-intervals (special-rnd-walk 5 :startpitch 'ds4 :pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6) :possible-intervals '(1 2 3)) ; + octaves of this intervals (special-rnd-walk 10 :startpitch 'ds4 :pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6) :possible-intervals '(1 3 4 5) :interval-octaves 0) ;;; reduced interval-span (special-rnd-walk 10 :startpitch 'ds4 :pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6) :possible-intervals '(5 6 7)) ; + octaves of this intervals  
    more examples -> SOUND
     
    ;;; rnd-versions so you will here the different interval-colors inside the pitchfield (setf seq (gen-sieve '(f3 fs6) '(4 2 1 1 1 2 4 7) :type :pitch)) ;(setf seq (gen-sieve '(f3 fs6) '(7 4 2 1 1 1 2 4) :type :pitch)) ;(setf seq '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6)) (setf pitchlist (special-rnd-walk (rnd-pick '(3 5 7 11)) :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals (rnd-pick '((1 2) (3 4) (5 6 7))) :interval-octaves 3)) (def-score intervals (:title "walk" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
     
    ;;; rnd-walk in SIEVE only with intervals '(5 6 8) (setf seq (gen-sieve '((c4 g7) (c2 g7)) '((2 1 10) (3 5)) :type :pitch)) (setf pitchlist (special-rnd-walk 30 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(5 6 8))) (def-score intervals (:title "intervals" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
     
    (setf seq (gen-sieve '((c2 g7) (c2 g7)) '((2 1 10) (3 5)) :type :pitch)) ;;; EXAMPLE with changes -> all inside the same SIEVE (setf pitchlist (append (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(1)) ; minor second (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(2)) ; major second (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(3 4)) ;thirds (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(5 7)))) ; fourth-fifth (def-score intervals (:title "intervals" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
  13. Like
    AM got a reaction from Stephane Boussuge in find-intervals*   
    i coded it to analyze a pitchfield
     
    ;;; a function witch filters/shows you all pitch-combinations by INTERVAL-SIZE ;;; from 1 to 11 ("octave-independent") ;;; for example you are interested to see all FIFTH-combinations in a SIEVE ;;; or to LIST all resulting/ordered intervals (defun equal/or (n alist) (car (loop for i in alist when (equal i n) collect 't))) ;;; FUNCTION (defun find-intervals* (pitch-seq &key (intervals 'all) (chord nil) (reduced-interval nil)) (let ((combs (combination 2 pitch-seq)) (ints) (int) (all-comb-pitches-intervals)) (progn (setf ints (loop for i in combs do (setf int (car (pitch-to-interval i))) when (>= int 0) collect (cond ((and (>= int 12) (<= int 24) (equal reduced-interval nil)) (- int 12)) ((and (>= int 24) (equal reduced-interval nil)) (- int 24)) (t int)))) (setf all-comb-pitches-intervals (loop for i from 1 upto 11 append (loop for j in (loop for x in combs for y in ints collect (cons y x)) when (= (car j) i) collect j))) (if (equal intervals 'all+int) all-comb-pitches-intervals (if (equal intervals 'all) (loop for i in all-comb-pitches-intervals when (equal chord t) collect (chordize (rest i)) else collect (rest i)) (loop for i in all-comb-pitches-intervals when (if (listp intervals) (equal/or (car i) intervals) (= (car i) intervals)); when (= (car i) intervals) collect (if (equal chord t) (chordize (rest i)) (rest i)))))))) ;;; EXAMPLES (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals '(1 5 7) ;; as list :reduced-interval t ;; -> only on/in the same octave :chord nil) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals '(1 3 7) :chord t) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 'all :chord t) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 2 :chord t) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 3) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 5) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 7) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 'all)  
    other example -> cmd3
     
    (setf seq (gen-sieve '(f3 fs6) '(4 2 1 1 1 2 4 7) :type :pitch)) ;(setf seq (gen-sieve '(f3 fs6) '(7 4 2 1 1 1 2 4) :type :pitch)) ;(setf seq '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6)) (append (find-intervals* seq :intervals 1 :chord t) (find-intervals* seq :intervals 2 :chord t) (find-intervals* seq :intervals 5 :chord t) (find-intervals* seq :intervals 6 :chord t) (find-intervals* seq :intervals 8 :chord t)) (find-intervals* seq :intervals 'all :chord t) ;;; with interval-sizes in output-format (find-intervals* seq :intervals 'all+int) => ((1 a3 bb5) (1 b3 c4) (1 b3 c6) (1 c4 cs4) (1 cs4 d4) (1 cs4 d6) (1 d4 eb5) (1 gs4 a5) (1 a5 bb5) (1 bb5 b5) (1 b5 c6) (2 f3 g5) (2 a3 b3) (2 a3 b5) (2 b3 cs4) (2 c4 d4) (2 c4 d6) (2 cs4 eb5) (2 d4 e4) (2 e4 fs6) (2 gs4 bb5) (2 g5 a5) (2 a5 b5) (2 bb5 c6) (2 c6 d6) (3 f3 gs4) (3 a3 c4) (3 a3 c6) (3 b3 d4) (3 b3 d6) (3 c4 eb5) (3 cs4 e4) (3 e4 g5) (3 gs4 b5) (3 eb5 fs6) (3 g5 bb5) (3 a5 c6) (3 b5 d6) (4 f3 a3) (4 f3 a5) (4 a3 cs4) (4 b3 eb5) (4 c4 e4) (4 d4 fs6) (4 e4 gs4) (4 gs4 c6) (4 eb5 g5) (4 g5 b5) (4 bb5 d6) (4 d6 fs6) (5 f3 bb5) (5 a3 d4) (5 a3 d6) (5 b3 e4) (5 cs4 fs6) (5 d4 g5) (5 e4 a5) (5 g5 c6) (5 a5 d6) (6 f3 b3) (6 f3 b5) (6 a3 eb5) (6 c4 fs6) (6 cs4 g5) (6 d4 gs4) (6 e4 bb5) (6 gs4 d6) (6 eb5 a5) (6 c6 fs6) (7 f3 c4) (7 f3 c6) (7 a3 e4) (7 b3 fs6) (7 c4 g5) (7 cs4 gs4) (7 d4 a5) (7 e4 b5) (7 gs4 eb5) (7 eb5 bb5) (7 g5 d6) (7 b5 fs6) (8 f3 cs4) (8 b3 g5) (8 c4 gs4) (8 cs4 a5) (8 d4 bb5) (8 e4 c6) (8 eb5 b5) (8 bb5 fs6) (9 f3 d4) (9 f3 d6) (9 a3 fs6) (9 b3 gs4) (9 c4 a5) (9 cs4 bb5) (9 d4 b5) (9 eb5 c6) (9 a5 fs6) (10 f3 eb5) (10 a3 g5) (10 b3 a5) (10 c4 bb5) (10 cs4 b5) (10 d4 c6) (10 e4 d6) (10 gs4 fs6) (11 f3 e4) (11 a3 gs4) (11 b3 bb5) (11 c4 b5) (11 cs4 c6) (11 e4 eb5) (11 gs4 g5) (11 eb5 d6) (11 g5 fs6))  
     
    perhaps OPMO could extend it to an omn-format-FILTER - so that all other pitches (not matched pitches/sets) would be repaced by rests? would be interesting to work like that with pitchfields/sieves.
    so you could choose ...for example: "want to have all FIFTHS including a pitch like C or Eb or Gs (octave independent)...? 
  14. Like
    AM got a reaction from Stephane Boussuge in rnd-walk in a pitchfield with specific interval-control   
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; rnd-walk in a pitchfield - with interval-control ;;; ;;; this is a little function which does an rnd-walk in a special way ;;; the function is checking all possible interval-pairs first inside the pitchfield ;;; so that is on one hand all the time "inside" the pitchfield/sieve, but also only ;;; uses the :POSSIBLE-INTERVALS, so you could control the "interval-color" of the walk ;;; in an non-chromatic-pitchfield/sieve ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun enlarge-intervals (possible-intervals &key (octaves 2)) (let ((possible-intervals (append possible-intervals (loop repeat octaves for i = 12 then (incf i 12) append (x+b possible-intervals i))))) (append possible-intervals (neg! possible-intervals)))) ;(enlarge-intervals '(2 3 4)) ;;;;;;;;;;; (defun special-rnd-walk (n &key pitchfield startpitch possible-intervals (interval-octaves 2)) (let ((int-list (loop for i in pitchfield collect (list (pitch-to-midi i) (loop for x in pitchfield with int do (setf int (car (pitch-to-interval (list i x)))) when (/= int 0) collect int)))) (possible-intervals (enlarge-intervals possible-intervals :octaves interval-octaves))) (append (list startpitch) (midi-to-pitch (loop repeat n with int with pitch = (pitch-to-midi startpitch) do (setf int (rnd-pick (filter-preserve possible-intervals (cadr (assoc pitch int-list))))) when (null int) do (setf int (rnd-pick (cadr (assoc pitch int-list)))) collect (setf pitch (pitch-to-midi (cadr (interval-to-pitch (list int) :start (midi-to-pitch pitch)))))))))) ;;;;;;;;;;; EXAMPLES ;;; rnd-walk in a "chromatic-field" - as the most easiest example/way ;;; => so all possible-intervals could be used -> THE ORDINARY WAY... (special-rnd-walk 20 :startpitch 'cs4 :pitchfield '(gs3 a3 bb3 b3 c4 cs4 d4 ds4 e4 f4 fs4 g4 gs4 a4) :possible-intervals '(1 2 3)) ;;; BUT have a look to the next examples!!! ;;; rnd-walk in a PITCHFIELD -> the function is checking all possible interval-pairs inside the pitchfield ;;; so that the rnd-walk INSIDE the PITCHFIELD could be done with specific intervals (if they are inside the field) ;;; COMPARE THE RESULT with the PITCHFIELD!!! ;;; (setf pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6)) ;;; "interval-color" of the walk is made with :possible-intervals (special-rnd-walk 5 :startpitch 'ds4 :pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6) :possible-intervals '(1 2 3)) ; + octaves of this intervals (special-rnd-walk 10 :startpitch 'ds4 :pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6) :possible-intervals '(1 3 4 5) :interval-octaves 0) ;;; reduced interval-span (special-rnd-walk 10 :startpitch 'ds4 :pitchfield '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6) :possible-intervals '(5 6 7)) ; + octaves of this intervals  
    more examples -> SOUND
     
    ;;; rnd-versions so you will here the different interval-colors inside the pitchfield (setf seq (gen-sieve '(f3 fs6) '(4 2 1 1 1 2 4 7) :type :pitch)) ;(setf seq (gen-sieve '(f3 fs6) '(7 4 2 1 1 1 2 4) :type :pitch)) ;(setf seq '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6)) (setf pitchlist (special-rnd-walk (rnd-pick '(3 5 7 11)) :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals (rnd-pick '((1 2) (3 4) (5 6 7))) :interval-octaves 3)) (def-score intervals (:title "walk" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
     
    ;;; rnd-walk in SIEVE only with intervals '(5 6 8) (setf seq (gen-sieve '((c4 g7) (c2 g7)) '((2 1 10) (3 5)) :type :pitch)) (setf pitchlist (special-rnd-walk 30 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(5 6 8))) (def-score intervals (:title "intervals" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
     
    (setf seq (gen-sieve '((c2 g7) (c2 g7)) '((2 1 10) (3 5)) :type :pitch)) ;;; EXAMPLE with changes -> all inside the same SIEVE (setf pitchlist (append (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(1)) ; minor second (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(2)) ; major second (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(3 4)) ;thirds (special-rnd-walk 50 :startpitch (rnd-pick seq) :pitchfield seq :possible-intervals '(5 7)))) ; fourth-fifth (def-score intervals (:title "intervals" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch pitchlist :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
  15. Like
    AM got a reaction from loopyc in bubble-sort   
    for a musical research project where i work with the sorting processes of different sorting algorithms (bubble-sort, heap-sort ...), i have to program such algorithms myself. the ide is that not only the end result of the algorithm is visible but also the constant changes (the mechansim). here the first: bubble-sort.
    very simple and inelegant programmed - but the thing i need to have  :-)
     
    bubble-sort:
    https://en.wikipedia.org/wiki/Bubble_sort
     
    have a look to different sorting algorithms:
     
     
    greetings
    andré
     
    ;;; bubble-sort -> with all GEN's to see the process of sorting ;;; end-test "until (equal (sort-asc alist) list)" very uncommon (and strange), ;;; but most simple-stupid test to check the end, only okay for this kind of idea ("watching the process not the endresult") (defun bubble-sort (seq) (let ((alist)) (progn (setf alist (cond ((pitchp (car seq)) (pitch-to-midi seq)) ((lengthp (car seq)) (omn :length seq)) (t seq))) (setf alist (loop until (equal (sort-asc alist) list) with list = alist append (loop for i from 0 to (- (length list) 2) for j from 1 to (- (length list) 1) when (> (nth i list) (nth j list)) collect (setf list (position-swap (list j i) list)) else do (setf list list)))) (cond ((pitchp (car seq)) (midi-to-pitch alist)) (t alist))))) (bubble-sort (rnd-order '(c5 e4 g3 b7))) (bubble-sort (rnd-order '(t s e q h w))) (bubble-sort '(1 6 334 2 6 4 111))  
  16. Like
    AM got a reaction from loopyc in gen-brownian-bridge   
    something new...
    greetings
    andré
     
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; BROWNIAN BRIDGE -> could be use as a rnd-process from A to B (integers or pitches) ;;; if you have a look to example with ":all-gen t", you will see the process with all generations, how it works ;;; or take a look to: ;;; https://de.wikipedia.org/wiki/Wiener-Prozess#/media/File:BrownscheBewegung.png ;;; https://de.wikipedia.org/wiki/Brownsche_Brücke ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; SUB (defun pick (a b &key (span 5)) (let ((rnd1 (car (rnd-number 1 (+ a span) (- a span)))) (rnd2 (car (rnd-number 1 (+ b span) (- b span)))) (n)) (progn (setf n (car (rnd-number 1 rnd1 rnd2))) (if (or (= n a) (= n b)) (+ (rnd-pick '(1 -1)) n) n)))) ;;; MAIN ;;; MAIN (defun gen-brownian-bridge (n startend &key (all-gen nil) (output 'integer) (span 5)) (let ((seq)) (progn (setf seq (append (list startend) (loop repeat n with liste = startend do (setf liste (filter-repeat 1 (loop repeat (1- (length liste)) for cnt = 0 then (incf cnt) append (append (list (nth cnt liste) (pick (nth cnt liste) (nth (1+ cnt) liste) :span span) (nth (1+ cnt) liste)))))) collect liste))) (setf seq (if (equal all-gen t) seq (car (last seq)))) (if (equal output 'pitch) (integer-to-pitch seq) seq)))) ;;; EXAMPLES ;; SPAN influence -> span 2 (list-plot (gen-brownian-bridge 5 '(50 23) :span 2 :all-gen t) :zero-based t :point-radius 3 :join-points t) ;; SPAN influence -> span 10 (list-plot (gen-brownian-bridge 5 '(50 23) :span 20 :all-gen t) :zero-based t :point-radius 3 :join-points t) ;;; SPAN default (5) (list-plot (gen-brownian-bridge 5 '(50 23) :all-gen t) :zero-based t :point-radius 3 :join-points t) (list-plot (gen-brownian-bridge 5 '(50 23)) :zero-based t :point-radius 3 :join-points t) (gen-brownian-bridge 5 '(50 23) :all-gen t :output 'pitch) (gen-brownian-bridge 5 '(50 23) :output 'pitch)  
    some sound-examples
     
    ;;; EXAMPLE with ALL GENS / seperated by rests (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 72) (instrument :omn (make-omn :pitch (setf n (gen-brownian-bridge 5 '(30 10) :all-gen t :output 'pitch)) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;; EXAMPLE with LAST GEN -> rnd-evaluations => rnd-ways from a to b (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 72) (instrument :omn (make-omn :pitch (gen-brownian-bridge (car (rnd-number 1 2 7)) '(30 10) :output 'pitch) :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
    two examples with different SPAN on MESSIEAN's mode5 mapped with <tonality-map>
     
    ;;; on MESSIAENS- mode5 - > 8 cycles + SPAN 10 => bigger intervals/steps (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch (setf n (tonality-map '(messiaen-mode5 :map step :root 'fs3) (integer-to-pitch (gen-brownian-bridge 8 '(10 27) :span 10 :all-gen t)))) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;; on MESSIAENS- mode5 - > 8 cycles + SPAN 3 => smaller intervals/steps (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch (setf n (tonality-map '(messiaen-mode5 :map step :root 'fs3) (integer-to-pitch (gen-brownian-bridge 8 '(10 27) :span 3 :all-gen t)))) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
  17. Thanks
    AM got a reaction from loopyc in sorting algorithms   
    i solved the problems. here is a workspace/files to experiment with SORTING ALGORITHMS 
    thanx to torsten and philippe!
     
    greetings
    andré
     
    functions.opmo
    abstract examples.opmo
    sound examples.opmo
    sorting algorithms.opmows
  18. Thanks
    AM got a reaction from loopyc in length-to-decimal / length-to-sec   
    two functions i needed for working with POLYTEMPO-NETWORK
     
    http://philippekocher.ch/#109
    http://polytempo.zhdk.ch
     
    greetings
    andré
     
    (defun length-to-decimal (alist &key (sum nil)) (let ((list (loop for i in (omn :length alist) collect (float (* i 4))))) (if (equal sum t) (sum list) list))) ;;; result: q = 1 / h. = 3 ...etc... (length-to-decimal '(h. h. 3q 5e 3h)) => (3.0 3.0 0.33333334 0.1 0.6666667) (length-to-decimal '(h. h. 3q 5e 3h) :sum t) => 7.1 (defun length-to-sec (alist tempo &key (sum nil)) (let ((list (loop for i in (omn :length alist) collect (* (/ 60 tempo) (float (* i 4)))))) (if (equal sum t) (sum list) list))) (length-to-sec '(h. h. 3q 5e 3h) 60) => (3.0 3.0 0.33333334 0.1 0.6666667) (length-to-sec '(h. h. 3q 5e 3h) 51) => (3.5294118 3.5294118 0.3921569 0.11764707 0.7843138) (length-to-sec '(h. h. 3q 5e 3h) 51 :sum t) => 8.3529415  
  19. Thanks
    AM got a reaction from opmo in find-intervals*   
    i coded it to analyze a pitchfield
     
    ;;; a function witch filters/shows you all pitch-combinations by INTERVAL-SIZE ;;; from 1 to 11 ("octave-independent") ;;; for example you are interested to see all FIFTH-combinations in a SIEVE ;;; or to LIST all resulting/ordered intervals (defun equal/or (n alist) (car (loop for i in alist when (equal i n) collect 't))) ;;; FUNCTION (defun find-intervals* (pitch-seq &key (intervals 'all) (chord nil) (reduced-interval nil)) (let ((combs (combination 2 pitch-seq)) (ints) (int) (all-comb-pitches-intervals)) (progn (setf ints (loop for i in combs do (setf int (car (pitch-to-interval i))) when (>= int 0) collect (cond ((and (>= int 12) (<= int 24) (equal reduced-interval nil)) (- int 12)) ((and (>= int 24) (equal reduced-interval nil)) (- int 24)) (t int)))) (setf all-comb-pitches-intervals (loop for i from 1 upto 11 append (loop for j in (loop for x in combs for y in ints collect (cons y x)) when (= (car j) i) collect j))) (if (equal intervals 'all+int) all-comb-pitches-intervals (if (equal intervals 'all) (loop for i in all-comb-pitches-intervals when (equal chord t) collect (chordize (rest i)) else collect (rest i)) (loop for i in all-comb-pitches-intervals when (if (listp intervals) (equal/or (car i) intervals) (= (car i) intervals)); when (= (car i) intervals) collect (if (equal chord t) (chordize (rest i)) (rest i)))))))) ;;; EXAMPLES (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals '(1 5 7) ;; as list :reduced-interval t ;; -> only on/in the same octave :chord nil) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals '(1 3 7) :chord t) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 'all :chord t) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 2 :chord t) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 3) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 5) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 7) (find-intervals* (gen-sieve '(c3 g7) '(3 1 5) :type :pitch) :intervals 'all)  
    other example -> cmd3
     
    (setf seq (gen-sieve '(f3 fs6) '(4 2 1 1 1 2 4 7) :type :pitch)) ;(setf seq (gen-sieve '(f3 fs6) '(7 4 2 1 1 1 2 4) :type :pitch)) ;(setf seq '(gs3 cs4 ds4 g4 a4 b4 d5 e5 fs5 bb5 c6 f6)) (append (find-intervals* seq :intervals 1 :chord t) (find-intervals* seq :intervals 2 :chord t) (find-intervals* seq :intervals 5 :chord t) (find-intervals* seq :intervals 6 :chord t) (find-intervals* seq :intervals 8 :chord t)) (find-intervals* seq :intervals 'all :chord t) ;;; with interval-sizes in output-format (find-intervals* seq :intervals 'all+int) => ((1 a3 bb5) (1 b3 c4) (1 b3 c6) (1 c4 cs4) (1 cs4 d4) (1 cs4 d6) (1 d4 eb5) (1 gs4 a5) (1 a5 bb5) (1 bb5 b5) (1 b5 c6) (2 f3 g5) (2 a3 b3) (2 a3 b5) (2 b3 cs4) (2 c4 d4) (2 c4 d6) (2 cs4 eb5) (2 d4 e4) (2 e4 fs6) (2 gs4 bb5) (2 g5 a5) (2 a5 b5) (2 bb5 c6) (2 c6 d6) (3 f3 gs4) (3 a3 c4) (3 a3 c6) (3 b3 d4) (3 b3 d6) (3 c4 eb5) (3 cs4 e4) (3 e4 g5) (3 gs4 b5) (3 eb5 fs6) (3 g5 bb5) (3 a5 c6) (3 b5 d6) (4 f3 a3) (4 f3 a5) (4 a3 cs4) (4 b3 eb5) (4 c4 e4) (4 d4 fs6) (4 e4 gs4) (4 gs4 c6) (4 eb5 g5) (4 g5 b5) (4 bb5 d6) (4 d6 fs6) (5 f3 bb5) (5 a3 d4) (5 a3 d6) (5 b3 e4) (5 cs4 fs6) (5 d4 g5) (5 e4 a5) (5 g5 c6) (5 a5 d6) (6 f3 b3) (6 f3 b5) (6 a3 eb5) (6 c4 fs6) (6 cs4 g5) (6 d4 gs4) (6 e4 bb5) (6 gs4 d6) (6 eb5 a5) (6 c6 fs6) (7 f3 c4) (7 f3 c6) (7 a3 e4) (7 b3 fs6) (7 c4 g5) (7 cs4 gs4) (7 d4 a5) (7 e4 b5) (7 gs4 eb5) (7 eb5 bb5) (7 g5 d6) (7 b5 fs6) (8 f3 cs4) (8 b3 g5) (8 c4 gs4) (8 cs4 a5) (8 d4 bb5) (8 e4 c6) (8 eb5 b5) (8 bb5 fs6) (9 f3 d4) (9 f3 d6) (9 a3 fs6) (9 b3 gs4) (9 c4 a5) (9 cs4 bb5) (9 d4 b5) (9 eb5 c6) (9 a5 fs6) (10 f3 eb5) (10 a3 g5) (10 b3 a5) (10 c4 bb5) (10 cs4 b5) (10 d4 c6) (10 e4 d6) (10 gs4 fs6) (11 f3 e4) (11 a3 gs4) (11 b3 bb5) (11 c4 b5) (11 cs4 c6) (11 e4 eb5) (11 gs4 g5) (11 eb5 d6) (11 g5 fs6))  
     
    perhaps OPMO could extend it to an omn-format-FILTER - so that all other pitches (not matched pitches/sets) would be repaced by rests? would be interesting to work like that with pitchfields/sieves.
    so you could choose ...for example: "want to have all FIFTHS including a pitch like C or Eb or Gs (octave independent)...? 
  20. Like
    AM reacted to Stephane Boussuge in Piano Trio "Slonimsky" Movement 1   
    Hi,
     
    here's for study purpose the Opusmodus score of the first movement of my piano trio.
     
    All the best to the wonderful Opusmodus users community !
     
    SB.

     
     
    PianoTrio-SlonimskyV2.opmo
  21. Like
    AM got a reaction from lviklund in gen-brownian-bridge   
    something new...
    greetings
    andré
     
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; BROWNIAN BRIDGE -> could be use as a rnd-process from A to B (integers or pitches) ;;; if you have a look to example with ":all-gen t", you will see the process with all generations, how it works ;;; or take a look to: ;;; https://de.wikipedia.org/wiki/Wiener-Prozess#/media/File:BrownscheBewegung.png ;;; https://de.wikipedia.org/wiki/Brownsche_Brücke ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; SUB (defun pick (a b &key (span 5)) (let ((rnd1 (car (rnd-number 1 (+ a span) (- a span)))) (rnd2 (car (rnd-number 1 (+ b span) (- b span)))) (n)) (progn (setf n (car (rnd-number 1 rnd1 rnd2))) (if (or (= n a) (= n b)) (+ (rnd-pick '(1 -1)) n) n)))) ;;; MAIN ;;; MAIN (defun gen-brownian-bridge (n startend &key (all-gen nil) (output 'integer) (span 5)) (let ((seq)) (progn (setf seq (append (list startend) (loop repeat n with liste = startend do (setf liste (filter-repeat 1 (loop repeat (1- (length liste)) for cnt = 0 then (incf cnt) append (append (list (nth cnt liste) (pick (nth cnt liste) (nth (1+ cnt) liste) :span span) (nth (1+ cnt) liste)))))) collect liste))) (setf seq (if (equal all-gen t) seq (car (last seq)))) (if (equal output 'pitch) (integer-to-pitch seq) seq)))) ;;; EXAMPLES ;; SPAN influence -> span 2 (list-plot (gen-brownian-bridge 5 '(50 23) :span 2 :all-gen t) :zero-based t :point-radius 3 :join-points t) ;; SPAN influence -> span 10 (list-plot (gen-brownian-bridge 5 '(50 23) :span 20 :all-gen t) :zero-based t :point-radius 3 :join-points t) ;;; SPAN default (5) (list-plot (gen-brownian-bridge 5 '(50 23) :all-gen t) :zero-based t :point-radius 3 :join-points t) (list-plot (gen-brownian-bridge 5 '(50 23)) :zero-based t :point-radius 3 :join-points t) (gen-brownian-bridge 5 '(50 23) :all-gen t :output 'pitch) (gen-brownian-bridge 5 '(50 23) :output 'pitch)  
    some sound-examples
     
    ;;; EXAMPLE with ALL GENS / seperated by rests (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 72) (instrument :omn (make-omn :pitch (setf n (gen-brownian-bridge 5 '(30 10) :all-gen t :output 'pitch)) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;; EXAMPLE with LAST GEN -> rnd-evaluations => rnd-ways from a to b (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 72) (instrument :omn (make-omn :pitch (gen-brownian-bridge (car (rnd-number 1 2 7)) '(30 10) :output 'pitch) :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
    two examples with different SPAN on MESSIEAN's mode5 mapped with <tonality-map>
     
    ;;; on MESSIAENS- mode5 - > 8 cycles + SPAN 10 => bigger intervals/steps (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch (setf n (tonality-map '(messiaen-mode5 :map step :root 'fs3) (integer-to-pitch (gen-brownian-bridge 8 '(10 27) :span 10 :all-gen t)))) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;; on MESSIAENS- mode5 - > 8 cycles + SPAN 3 => smaller intervals/steps (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch (setf n (tonality-map '(messiaen-mode5 :map step :root 'fs3) (integer-to-pitch (gen-brownian-bridge 8 '(10 27) :span 3 :all-gen t)))) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
  22. Like
    AM got a reaction from opmo in gen-brownian-bridge   
    something new...
    greetings
    andré
     
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; BROWNIAN BRIDGE -> could be use as a rnd-process from A to B (integers or pitches) ;;; if you have a look to example with ":all-gen t", you will see the process with all generations, how it works ;;; or take a look to: ;;; https://de.wikipedia.org/wiki/Wiener-Prozess#/media/File:BrownscheBewegung.png ;;; https://de.wikipedia.org/wiki/Brownsche_Brücke ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; SUB (defun pick (a b &key (span 5)) (let ((rnd1 (car (rnd-number 1 (+ a span) (- a span)))) (rnd2 (car (rnd-number 1 (+ b span) (- b span)))) (n)) (progn (setf n (car (rnd-number 1 rnd1 rnd2))) (if (or (= n a) (= n b)) (+ (rnd-pick '(1 -1)) n) n)))) ;;; MAIN ;;; MAIN (defun gen-brownian-bridge (n startend &key (all-gen nil) (output 'integer) (span 5)) (let ((seq)) (progn (setf seq (append (list startend) (loop repeat n with liste = startend do (setf liste (filter-repeat 1 (loop repeat (1- (length liste)) for cnt = 0 then (incf cnt) append (append (list (nth cnt liste) (pick (nth cnt liste) (nth (1+ cnt) liste) :span span) (nth (1+ cnt) liste)))))) collect liste))) (setf seq (if (equal all-gen t) seq (car (last seq)))) (if (equal output 'pitch) (integer-to-pitch seq) seq)))) ;;; EXAMPLES ;; SPAN influence -> span 2 (list-plot (gen-brownian-bridge 5 '(50 23) :span 2 :all-gen t) :zero-based t :point-radius 3 :join-points t) ;; SPAN influence -> span 10 (list-plot (gen-brownian-bridge 5 '(50 23) :span 20 :all-gen t) :zero-based t :point-radius 3 :join-points t) ;;; SPAN default (5) (list-plot (gen-brownian-bridge 5 '(50 23) :all-gen t) :zero-based t :point-radius 3 :join-points t) (list-plot (gen-brownian-bridge 5 '(50 23)) :zero-based t :point-radius 3 :join-points t) (gen-brownian-bridge 5 '(50 23) :all-gen t :output 'pitch) (gen-brownian-bridge 5 '(50 23) :output 'pitch)  
    some sound-examples
     
    ;;; EXAMPLE with ALL GENS / seperated by rests (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 72) (instrument :omn (make-omn :pitch (setf n (gen-brownian-bridge 5 '(30 10) :all-gen t :output 'pitch)) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;; EXAMPLE with LAST GEN -> rnd-evaluations => rnd-ways from a to b (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 72) (instrument :omn (make-omn :pitch (gen-brownian-bridge (car (rnd-number 1 2 7)) '(30 10) :output 'pitch) :length '(t) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
    two examples with different SPAN on MESSIEAN's mode5 mapped with <tonality-map>
     
    ;;; on MESSIAENS- mode5 - > 8 cycles + SPAN 10 => bigger intervals/steps (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch (setf n (tonality-map '(messiaen-mode5 :map step :root 'fs3) (integer-to-pitch (gen-brownian-bridge 8 '(10 27) :span 10 :all-gen t)))) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;; on MESSIAENS- mode5 - > 8 cycles + SPAN 3 => smaller intervals/steps (def-score brownian-bridge (:title "score title" :key-signature 'atonal :time-signature '(4 4) :tempo 90) (instrument :omn (make-omn :pitch (setf n (tonality-map '(messiaen-mode5 :map step :root 'fs3) (integer-to-pitch (gen-brownian-bridge 8 '(10 27) :span 3 :all-gen t)))) :length (loop for i in n append (list '-1/4 (loop repeat (length i) append '(t)))) :span :pitch) :channel 1 :sound 'gm :program 'acoustic-grand-piano))  
  23. Like
    AM reacted to opmo in mapping <gen-sort> by <tonality-map>   
    You can use the :span :pitch option if the master is the pitch:
     
    Example:
     
    (make-omn :pitch (tonality-map '(messiaen-mode5 :map step :root 'c4) sort-seq) :length '(t) :span :pitch) (make-omn :pitch (loop for i in sort-seq collect (nth i sieve)) :length '(t) :span :pitch)
     
     
  24. Like
    AM reacted to opmo in tonality-map: controlling in which octave tones occur   
    I will make some changes to the TONALITY-MAP which will allow us to use scales lager then an octave.
  25. Like
    AM reacted to opmo in mapping integer?   
    There is an internal function which expand any scale (a sequence) to a total octaves span with ambitus from -60 to 67.
    I will make a document for it.
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy