Jump to content

AM

Members
  • Content Count

    544
  • Joined

  • Last visited

Posts posted by AM


  1. short question: is it possible to add a text-attribute to/above a rest? i didn't find a solution for that...

     

    for post-editing my score i would like to delete/augment/... specific values... for example: AUGMENT rest number 12, or DELETE pitch number 27 (like every EVENT woud has its number) - to do that i numbered all the pitches in the score, but seems not possible to number (by adding text-attributes) the rest-values?? 

     

    it's no problem to extend the EVENTS by any extra-data-slots (i wrote such a function), but i don't know how to display text above RESTS?

     

    thanx for help

    andré

     


  2. here are 2 sound-examples of such a process

    - evaluate the FUNCTIONS: incf/decf-alist and round-to

    - evaluate example with cmd2/cmd3

    - have a look to the list-plot

    (progn
      (setf durations  (rnd-number 10 1 19 :prob 0.4))
      
      (setf seq1 (append
                  (make-omn :length (gen-length (flatten 
                                                 (incf/decf-alist 
                                                  100 
                                                  (rnd-order durations)
                                                  :steps (rnd-number 10 1 5 :prob 0.2) :end 2))
                                                 32)
                            :pitch '(c4)
                            :velocity '(pp))
    
                  (make-omn :length (gen-length (flatten
                                                 (incf/decf-alist 
                                                 100 
                                                 (rnd-order durations)
                                                 :steps (rnd-number 10 1 5 :prob 0.2) :end 3))
                                                32)
                            :pitch '(b4)
                            :velocity '(f))
                  
                  (make-omn :length (gen-length (reverse 
                                                 (flatten
                                                  (incf/decf-alist 
                                                   100 
                                                   (rnd-order durations)
                                                   :steps (rnd-number 10 1 5 :prob 0.2) :end 1)))
                                                32)
                            :pitch '(f4)
                            :velocity '(mf)))))
    
      
    (length-list-plot (omn :length seq1))
    
    
    (progn
      (setf durations  (rnd-number 10 1 7 :prob 0.4))
      
      (setf seq2 (make-omn :length (gen-length (append (reverse 
                                                        (flatten
                                                         (incf/decf-alist 
                                                          50 
                                                          (setf list (rnd-order durations))
                                                          :steps (rnd-number 10 1 5 :prob 0.2) :end 2)))
                                                       (flatten
                                                        (incf/decf-alist 
                                                         50 
                                                         list
                                                         :steps (rnd-number 10 1 5 :prob 0.2) :end 1)))
                                               32)
                            :pitch '(f4)
                            :velocity '(mf))))
    
      
    (length-list-plot (omn :length seq2))

     

     


  3. a less flexible version but with nicer output/usage...

    greetings

     

    
    
    (defun round-to (number precision &optional (what #'round))
        (let ((div (expt 10 precision)))
             (/ (funcall what (* number div)) div)))
    
    ;;;
    
    
    (defun incf/decf-alist (n alist &key (steps '(1 2)) (end 1))
      (let ((span (round-to (/ n (length alist)) 0)))
        (progn
          (setf alist (loop 
                        for start in alist
                        for step in (if (< (length steps) (length alist))
                                      (filter-first (length alist) (loop repeat (length alist) append steps))
                                      steps)
                        
                        when (> start end)
                        collect (loop for i from start downto end by step
                                  collect i)
                        else collect (loop for i from start to end by step
                                       collect i)))
          (setf alist (loop for i in alist
                        collect (append i (gen-repeat (- span (length i)) end))))
    
          (loop repeat (length (car alist))
            for cnt = 0 then (incf cnt)
            collect (loop for i in alist
                      collect (nth cnt i))))))
    
    (list-plot
     (flatten
      (incf/decf-alist 90 '(9 8 7 1 7 30 8 7 6 1) :steps '(1 2 1 3 1 5 3 1 2 1) :end 11))
     :join-points t)
    
    =>((9 8 7 1 7 30 8 7 6 1) (10 10 8 4 8 25 11 8 8 2) (11 11 9 7 9 20 11 9 10 3) (11 11 10 10 10 15 11 10 11 4) (11 11 11 11 11 11 11 11 11 5) (11 11 11 11 11 11 11 11 11 6) (11 11 11 11 11 11 11 11 11 7) (11 11 11 11 11 11 11 11 11 8) (11 11 11 11 11 11 11 11 11 9))

    Ohne Titel.jpeg

     


  4. use it or not...

    greetings

    andré

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;; count-up/down => not well coded but it works
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    ;;; A FUNCTION which counts a integer-list from its values (individual) 
    ;;; to value B (all the same end-value :to (default is 1))
    
    ;;; n => how many output values (approx: depends on input/round... was not important for my project)
    ;;; up or down (default is 'down)
    ;;; with variabel STEPS => sequencieally (horizontal) or with steps for each value individiual (vertical)
    ;;; with COUNT => means how many lists with same values (like "global-steps")
    
    
    ;;; SUB
    (defun round-to (number precision &optional (what #'round))
        (let ((div (expt 10 precision)))
             (/ (funcall what (* number div)) div)))
    
    
    ;;; MAIN
    (defun count-up/down (n intlist &key (steps '(1)) (count 1) (type 'horizontal) (direction 'down) (to 1))
      (let* ((cycles  (round-to (/ (1- n) (length intlist)) 0))
             (intlists (cond ((equal type 'horizontal) 
                             (loop repeat cycles
                               for cnt = 0 then (incf cnt)
                               for stp in (if (< (length steps) cycles)
                                            (filter-first cycles (flatten (gen-repeat cycles steps)))
                                            steps)
                               when (= cnt 0) append (loop repeat count collect intlist)
                               when (integerp (/ cnt count))
                               collect (setf intlist (if (equal direction 'down)
                                                       (loop for i in intlist
                                                         when (>= (- i stp) to)
                                                         collect (- i stp)
                                                         else collect to)
                                                       (loop for i in intlist
                                                       when (<= (+ i stp) to)
                                                       collect (+ i stp)
                                                       else collect to)))
                               else collect intlist))
    
                            ((equal type 'vertical) 
                             (loop repeat cycles
                               for cnt = 0 then (incf cnt)
                               
                               when (= cnt 0) append (loop repeat count collect intlist)
                               when (integerp (/ cnt count))
                               collect (setf intlist (if (equal direction 'down)
                                                       (loop 
                                                         for i in intlist
                                                         for stp in steps
                                                         when (>= (- i stp) to)
                                                         collect (- i stp)
                                                         else collect to)
    
                                                       (loop 
                                                         for i in intlist
                                                         for stp in steps
                                                         when (<= (+ i stp) to)
                                                         collect (+ i stp)
                                                         else collect to)))
    
                               else collect intlist)))))    
        (loop repeat cycles
          for x in intlists
          collect x)))
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;; SIMPLE EXAMPLES
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    (list-plot 
     (flatten 
      (count-up/down 100 '(9 8 7 6 7 9 8 7 6 7) :to 3 :direction 'down))
     :join-points t)
    
    => ((9 8 7 6 7 9 8 7 6 7) (8 7 6 5 6 8 7 6 5 6) (7 6 5 4 5 7 6 5 4 5) (6 5 4 3 4 6 5 4 3 4) (5 4 3 3 3 5 4 3 3 3) (4 3 3 3 3 4 3 3 3 3) (3 3 3 3 3 3 3 3 3 3) (3 3 3 3 3 3 3 3 3 3) (3 3 3 3 3 3 3 3 3 3) (3 3 3 3 3 3 3 3 3 3))
    
    
    (list-plot 
     (flatten 
      (count-up/down 100 '(9 8 7 6 7 9 8 7 6 7) :count 2 :to 5 :direction 'down))
     :join-points t)
    
    => ((9 8 7 6 7 9 8 7 6 7) (9 8 7 6 7 9 8 7 6 7) (8 7 6 5 6 8 7 6 5 6) (8 7 6 5 6 8 7 6 5 6) (7 6 5 5 5 7 6 5 5 5) (7 6 5 5 5 7 6 5 5 5) (6 5 5 5 5 6 5 5 5 5) (6 5 5 5 5 6 5 5 5 5) (5 5 5 5 5 5 5 5 5 5) (5 5 5 5 5 5 5 5 5 5))
    
    
    (list-plot 
     (flatten
      (count-up/down 100 '(9 8 7 6 7 9 8 7 6 7) :to 15 :direction 'up))
       :join-points t)
    
    => ((9 8 7 6 7 9 8 7 6 7) (10 9 8 7 8 10 9 8 7 8) (11 10 9 8 9 11 10 9 8 9) (12 11 10 9 10 12 11 10 9 10) (13 12 11 10 11 13 12 11 10 11) (14 13 12 11 12 14 13 12 11 12) (15 14 13 12 13 15 14 13 12 13) (15 15 14 13 14 15 15 14 13 14) (15 15 15 14 15 15 15 15 14 15) (15 15 15 15 15 15 15 15 15 15))
    
    (list-plot 
     (flatten
      (count-up/down 200 '(9 8 7 6 7 9 8 7 6 7) :count 2 :to 15 :direction 'up))
       :join-points t)
    
    => ((9 8 7 6 7 9 8 7 6 7) (9 8 7 6 7 9 8 7 6 7) (10 9 8 7 8 10 9 8 7 8) (10 9 8 7 8 10 9 8 7 8) (11 10 9 8 9 11 10 9 8 9) (11 10 9 8 9 11 10 9 8 9) (12 11 10 9 10 12 11 10 9 10) (12 11 10 9 10 12 11 10 9 10) (13 12 11 10 11 13 12 11 10 11) (13 12 11 10 11 13 12 11 10 11) (14 13 12 11 12 14 13 12 11 12) (14 13 12 11 12 14 13 12 11 12) (15 14 13 12 13 15 14 13 12 13) (15 14 13 12 13 15 14 13 12 13) (15 15 14 13 14 15 15 14 13 14) (15 15 14 13 14 15 15 14 13 14) (15 15 15 14 15 15 15 15 14 15) (15 15 15 14 15 15 15 15 14 15) (15 15 15 15 15 15 15 15 15 15) (15 15 15 15 15 15 15 15 15 15))
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;; MORE COMPLEX/INTERESTING EXAMPLES
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    ;; horizontal means every cycle has a new step-value
    (list-plot 
     (flatten
      (count-up/down 100 '(9 8 7 6 7 15 8 7 6 7) :steps '(1 2 1 1 1 1 1 1 1 1) :type 'horizontal :to 2))
        :join-points t)
    
    => ((9 8 7 6 7 15 8 7 6 7) (8 7 6 5 6 14 7 6 5 6) (6 5 4 3 4 12 5 4 3 4) (5 4 3 2 3 11 4 3 2 3) (4 3 2 2 2 10 3 2 2 2) (3 2 2 2 2 9 2 2 2 2) (2 2 2 2 2 8 2 2 2 2) (2 2 2 2 2 7 2 2 2 2) (2 2 2 2 2 6 2 2 2 2) (2 2 2 2 2 5 2 2 2 2))
    
    
    ;; vertical means every value has its individual step
    (list-plot 
     (flatten
      (count-up/down 100 '(9 8 7 6 7 30 8 7 6 7) :steps '(1 2 1 1 1 5 1 1 1 1) :type 'vertical :to 2))
       :join-points t)
    
    => ((9 8 7 6 7 30 8 7 6 7) (8 6 6 5 6 25 7 6 5 6) (7 4 5 4 5 20 6 5 4 5) (6 2 4 3 4 15 5 4 3 4) (5 2 3 2 3 10 4 3 2 3) (4 2 2 2 2 5 3 2 2 2) (3 2 2 2 2 2 2 2 2 2) (2 2 2 2 2 2 2 2 2 2) (2 2 2 2 2 2 2 2 2 2) (2 2 2 2 2 2 2 2 2 2))
                                 
    (list-plot 
     (flatten
      (count-up/down 100 '(9 8 7 6 7 30 8 7 6 7) :steps '(1 2 1 3 1 5 3 1 2 1) :type 'vertical :to 1))
       :join-points t)

     

    could be extended: would be nice if the END-VALUE (:to)  would/could be also "in between" the start values... start '(6 7 5 1 2 3 9 19)  => :to 4  => values incf, and decf to 4


  5. ....you are totally right!!!! i did not know this function, i did not find it when i was searching  😕

    so, perhaps somebody could need/read my function "as a LISP-example"...

     

    in OPMO:

    (setf omn-seq '(s c4 ffff ord e ord e ord s ord e. ord s ord q ord q q q q)) 
    
    (length-map '((1/16 mute) (2/16 pizz) (3/16 arco)) omn-seq)
    => (s c4 ffff mute e pizz c4 pizz s mute e. arco s mute q ord c4 c4 c4 c4)

     

     


  6. if you like to change the articulation of specific lengths

     

    (defun replace-articulation-of-a-length (omnseq length/articulation-map)
      (loop for i in (single-events (flatten omnseq))
        when (length-restp (car i)) collect i
        else append (omn-replace :articulation (cadr (assoc (car (omn :length i)) length/articulation-map))
                                  i)))
                       
    (setf omn-seq '(s c4 ffff ord e ord e ord s ord e. ord s ord q ord q q q q))  
                     
    (replace-articulation-of-a-length omn-seq '((1/16 mute) (2/16 pizz) (3/16 arco)))
    
    => (s c4 ffff mute e c4 ffff pizz e c4 ffff pizz s c4 ffff mute e. c4 ffff arco s c4 ffff mute q c4 ffff ord q c4 ffff q c4 ffff q c4 ffff q c4 ffff)

     


  7. if you like to change dynamics/velocity of specific lengths

     

    (defun replace-velocity-of-a-length (omnseq length/velocity-map)
      (loop for i in (single-events (flatten omnseq))
        when (length-restp (car i)) collect i
        else append (omn-replace :velocity (cadr (assoc (car (omn :length i)) length/velocity-map))
                                  i)))
                       
    
    (setf omn-seq '(s c4 ffff e e s e. s q q q q q))                   
    
    (replace-velocity-of-a-length omn-seq '((1/16 mp)
                                            (2/16 pp)
                                            (3/16 ppp)))
    
    => (s c4 mp e c4 pp e c4 pp s c4 mp e. c4 ppp s c4 mp q c4 ffff q c4 ffff q c4 ffff q c4 ffff q c4 ffff)

     


  8. in my personal view:

     

    - for algorithmic composition ...you have first to be a composer/musician - because it's a lot more about music then about code (i learned a little bit to code, because i was interested in this "kind of thinking" about art and music

     

    - so, i think, if you want to work with algorithms you have to handle some code (like in music you have to handle some pitches/sound/rhythms)

     

    - when you have a look to the history of algorithmic composition you see some software like: common music, open music, pwgl, patchwork, also supercollider or MAX etc, it has always to do with computer/code/algorithm. also PWGL, commonmusic, openmusic... are working with LISP (or parts of it), so i think, that's the thing. mostly i like in OPUSMODUS the direct connection to the SCORE etc... i like it also because it's very OPEN for some own things/code/ideas (because it's close to the basic COMMON LISP)...

     

    - you could work with all the EXAMPLES in the library, take it, do some smooth changes and have a look what happens...

     

    greetings

    andré 

     


  9. is there an RESPELL-function which would change sharps into flats and flats into sharps for single pitch-values? enharmonic changes....

     

    like: 

     

    (enharmonic 'cs4)
    => db4
    
    (enharmonic 'db4)
    => cs4

     

    but there is an other solution for an EQUALP* whicht is "independent" from pitch-name (enharmonic)... but a function like ENHARMONIC or EQUALP* could be useful (for pattern-match etc)...

     

    (defun equalp* (a b)
      (equal (pitch-to-midi a) (pitch-to-midi b)))
    
    
    (equalp* 'cs4 'db4)
    => t

     

    there is an EQUALP in the system (but not documented), and works like that

    (equalp 'cs4 'db4)
    => nil
    
    (equalp 'cs4 'cs4)
    => t

    :

     

     


  10. i think it's only possible by :controllers with pitch-bend-messages. i have seen the example, but i have no idea how to realize it without a really concrete example - i'm an absolut beginner with MIDI-etc-things 🙄

     

    what i have to write in the :controllers-section - which "midi-number/numbers" for pitch-bend? the bending in conTimbre needs an integer between 1 and 127 => 64 is no-tuning/bend?

     

    are there any specialists around in the forum? 🙂

     


  11. hi all, i think a it's a beginner-question...

     

    in SIBELIUS i can write for microtonal things MIDI PITCH BEND MESSAGES to every note i want - or automatically by a plugin. in the score/above the note then it's written for example ~B0,70 etc....

     

    (my PLAYER (conTimbre) works from SIBELIUS via VST) - now the question: how do i send such MIDI-pitch-bend-messages from OPUSMODUS? the opmo-tuning seems to work different and don't work with conTimbre-player...

     

    https://www.contimbre.com/en/

     

    thanx for any help

    andré


  12. ;; a function which fills up a sequence randomly - max-length = length sequence
    ;; (regardless of the number of cycles)
    
    
    (defun rnd-complete-seq (n &key sequence (step 1) seed (sort '<) (exclude nil) (append-excluded nil))
      (let* ((testseq)
             (sequence (if (null exclude)
                        sequence 
                        (filter-remove exclude sequence)))
             (sequence (loop repeat (length sequence)
                         with sequence = (loop repeat n
                                           with seq = '()
                                           do (setf seq (append (rnd-unique step sequence :seed seed) seq))
                                           do (setf sequence (filter-remove seq sequence))
                                           collect seq)
                         for i in (if (equal sort '<)
                                    (sort-asc sequence)
                                    (sort-desc sequence))
                         collect i)))
    
        (if (null append-excluded)
          sequence 
          (progn 
            (cond ((pitchp (first (car (last sequence))))
                   (setf testseq (pitch-to-midi sequence)))
                  ((velocityp (first (car (last sequence))))
                   (setf testseq (get-velocity sequence)))
                  (t (setf testseq sequence)))
    
            (if (< (first (car (last testseq))) (second (car (last testseq))))
              (list sequence (sort-asc (append exclude (car (last sequence)))))
              (list sequence (sort-desc (append exclude (car (last sequence))))))))))
    
    
    ;;; EXAMPLES
    
    (rnd-complete-seq 8 :sequence (expand-tonality '(b3 messiaen-mode6)))
    => ((b3) (b3 a4) (b3 a4 as4) (b3 f4 a4 as4) (b3 e4 f4 a4 as4) (b3 cs4 e4 f4 a4 as4) (b3 cs4 ds4 e4 f4 a4 as4) (b3 cs4 ds4 e4 f4 g4 a4 as4))
    ;or
    => ((as4) (e4 as4) (e4 f4 as4) (cs4 e4 f4 as4) (cs4 e4 f4 g4 as4) (b3 cs4 e4 f4 g4 as4) (b3 cs4 ds4 e4 f4 g4 as4) (b3 cs4 ds4 e4 f4 g4 a4 as4))
    ;or .... 
    
    
    (rnd-complete-seq 5 :sequence '(0 1 2 3 4 5 6 7 8 9 10 11 12))
    => ((1) (1 7) (0 1 7) (0 1 7 9) (0 1 7 9 11))
    ;or 
    => ((0) (0 1) (0 1 11) (0 1 6 11) (0 1 6 11 12))
    ;or .... 
    
    
    (rnd-complete-seq 5 :step 2 :sequence '(0 1 2 3 4 5 6 7 8 9 10 11 12))
    => ((1 7) (0 1 7 8) (0 1 5 7 8 12) (0 1 5 7 8 9 10 12) (0 1 2 5 7 8 9 10 11 12))
    
    (rnd-complete-seq 5 :step 2 :sequence '(0 1 2 3 4 5 6 7 8 9 10 11 12) :seed 234)
    => ((4 12) (3 4 11 12) (2 3 4 10 11 12) (2 3 4 5 9 10 11 12) (1 2 3 4 5 8 9 10 11 12))
    
    
    (rnd-complete-seq 5 :step 2 :sequence '(0 1 2 3 4 5 6 7 8 9 10 11 12) :sort '> :seed 234)
    => ((12 4) (12 11 4 3) (12 11 10 4 3 2) (12 11 10 9 5 4 3 2) (12 11 10 9 8 5 4 3 2 1))
    
    
    (rnd-complete-seq 5 :step 2 :sequence '(pppp ppp pp p mp mf f ff fff ffff) :sort '> :seed 234)
    => ((ffff p) (ffff fff p pp) (ffff fff ff p pp ppp) (ffff fff ff f mp p pp ppp) (ffff fff ff f mf mp p pp ppp pppp))
    
    
    ;;; examples with EXCLUDE
    
    (rnd-complete-seq 4 :sequence '(1 2 3 4 5 6 7 8) :exclude '(1 8))
    => ((5) (4 5) (2 4 5) (2 4 5 6))
    
    (rnd-complete-seq 4 :sequence '(1 2 3 4 5 6 7 8) :exclude '(1 8) :append-excluded t)
    => (((7) (4 7) (4 5 7) (4 5 6 7)) (1 4 5 6 7 8))
    
    (rnd-complete-seq 4 :sequence '(pppp ppp pp p mp mf f ff fff ffff) :exclude '(pppp ffff) :append-excluded t)
    => (((mf) (p mf) (ppp p mf) (ppp p mf f)) (pppp ppp p mf f ffff))

     


  13. i like to insert many text-attrib (hundreds) into the opmo-function (ADD-TEXT-ATTRIBUTES)
    ... how can i format it the right way when i generate it by a function?

     

    thanx for help!!

    andré

     

    ;;; ordinary... by hand - works fine
    
    (add-text-attributes
     '(nr0 "0") 
     '(nr1 "1") 
     '(nr2 "2") 
     '(nr3 "3") 
     '(nr4 "4") 
     '(nr5 "5"))
     
    
    
    
    ;;; generated by a function as a list (if there are many attributes)
    
    (setf attr-list
          (loop for i from 0 to 100
            collect (list (compress (list 'nr i)) (write-to-string i))))
    
    
    ;;; INSERT don't work because of the wrong format.... how can i do that/change the format??
    
    (add-text-attributes
     attr-list)
    
    => Error: Mismatched keys and values, (:notation-text) and ((nr1 "1") (nr2 "2") (nr3 "3") (nr4 "4") (nr5 "5") (nr6 "6") (nr7 "7") (nr8 "8") (nr9 "9") (nr10 "10") (nr11 "11") (nr12 "12") (nr13 "13") (nr14 "14") (nr15 "15") (nr16 "16") (nr17 "17") (nr18 "18") (nr19 "19") (nr20 "20") ...)

     


  14. works, but only for one-time-repetiton... could you use it?

     

    (defun merge-lengths-of-a-pitch-rep (omn-seq)
      (let* ((omn-seq (single-events omn-seq)) (l))
        (flatten (loop repeat (length omn-seq)
                   for cnt = 0 then (incf cnt)
                   
                   when (equal (omn :pitch (nth cnt omn-seq)) (omn :pitch (nth (1+ cnt) omn-seq)))
                   do (progn 
                        (setf l (length-note-merge (append (omn :length (nth cnt omn-seq)) (omn :length  (nth (1+ cnt) omn-seq)))))
                        (incf cnt))
                   and collect (omn-replace :length l (nth cnt omn-seq))
                   else collect  (nth cnt omn-seq)))))
      
    (merge-lengths-of-a-pitch-rep '(e c4 mf d4 d4 e4 f4 f4))
    => (e c4 mf q d4 mf e e4 mf q f4 mf)

     


  15. i know, but i would like to code it and not to write it by hand 🙂

     

    here is the solution:

     

    ;;; THE NUM-FUCTION for ARTICULATION
    
    (defun gen-num (n &key (start 0))
      (loop for i from start to n
        append (list (compress (list 'num i)))))
      
    ;;;
    
    (setf pitches (loop repeat 20 collect (rnd-pick '(c4 d4 e4 f4))))
    (setf articulation (gen-num (length pitches)))
    
    (make-omn :pitch pitches 
              :articulation articulation
              :length '(t)
              :span :pitch)
    
    => (t f4 num0 e4 num1 c4 num2 d4 num3 e4 num4 f4 num5 d4 num6 d4 num7 f4 num8 f4 num9 c4 num10 d4 num11 e4 num12 d4 num13 f4 num14 f4 num15 e4 num16 d4 num17 e4 num18 c4 num19)

     

    @janusz: it works like that... but num0, num1... stops at num100, higher numbers seems not to be possible... but i would need about 1000 🙂

     


  16. ;;; removes pitches by its position-number, will be replaced by rests. (starts with 0)
    
    (defun omn-pitch-position-remove (positions omnseq)
      (length-rest-merge (loop for i in (single-events omnseq)
                           with cnt = 0
                           
                           when (and (pitchp (cadr i)) 
                                     (not (equal 'nil (member cnt positions))))
                           append (make-omn :length (list (length-invert (car i))))
                           else append i
                           
                           when (pitchp (cadr i))
                           do (incf cnt))))
    
    
    (omn-pitch-position-remove '(0 1) '(-q e c4 e d4 e e4 e e e e))
    => (-h e e4 mf e4 e4 e4 e4)
    
    (omn-pitch-position-remove '(2 4) '(-q e c4 e d4 e e4 e e e e))
    => (-q e c4 mf d4 - e4 - e4 e4)

    or more common

     

    
    
    (defun omn-position-remove (positions omnseq &key (type 'pitch))
      (length-rest-merge (loop for i in (single-events omnseq)
                           with cnt = 0
                           
                           when (and (cond ((equal type 'pitch)
                                            (pitchp (cadr i)))
                                           ((equal type 'length)
                                            (lengthp (car i))))                                     
                                     (not (equal 'nil (member cnt positions))))
    
                           append (make-omn :length (list (length-invert (car i))))
                           else append i
                           
                           when (cond ((equal type 'pitch)
                                       (pitchp (cadr i)))
                                      ((equal type 'length)
                                       (lengthp (car i))))
                           do (incf cnt))))
    
    (omn-position-remove '(2 4) '(-q e c4 e d4 e e4 e e e e) :type 'pitch)
    => (-q e c4 mf d4 - e4 - e4 e4)
    
    (omn-position-remove '(0 4) '(e c4 e d4 e e4 e e e e) :type 'length)
    => (-e d4 mf e4 e4 - e4 e4)

    could be also extended for articulation/velocity

     

×
×
  • Create New...