Jump to content

erka

Members
  • Posts

    104
  • Joined

  • Last visited

Posts posted by erka

  1. Edit: Thanks to Janusz and Stephane I could correct and improve the function .    See below.

     

    This is an earlier version:

    For the fun of it and hopefully some use I wrote this simple function:

    ;;;;;;;;;

    (defun rk_rnd-order-omn (inomnl &key (exclude nil) seed  (flat nil))
    "to exclude use l for :length, p for :pitch, v for :velocity; d for :duration, a for :articulation, 
     leg for :leg, ped for :ped;   i.e :exclude '(p leg)
      To be even more random flatten the omn with :flat t"
      (let* ( 
              (state *init-seed* )
              (vseed (rnd-seed seed))
              (omnl (if flat (flatten inomnl) inomnl))
              (len (if (member 'l exclude) (omn :length omnl) (rnd-order (omn :length omnl) :seed vseed) )) 
              (pit (if (member 'p exclude) (omn :pitch omnl) (rnd-order (omn :pitch omnl) :seed vseed) )) 
              (vel (if (member 'v exclude) (omn :velocity omnl) (rnd-order (omn :velocity omnl) :seed vseed) )) 
              (dur (if (member 'd exclude) (omn :duration omnl) (rnd-order (omn :duration omnl) :seed vseed) )) 
              (arti (if (member 'a exclude) (omn :articulation omnl) (rnd-order (omn :articulation omnl) :seed vseed) )) 
              (vleg (if (member 'leg exclude) (omn :leg omnl) (rnd-order (omn :leg omnl) :seed vseed) )) 
              (vped (if (member 'ped exclude) (omn :ped omnl) (rnd-order (omn :ped omnl) :seed vseed) ))
              (x )
           )
           (progn
             (init-state state) 
             (make-omn :length len :pitch pit :velocity vel :duration dur :articulation arti  :leg vleg :ped vped)
           )
      )
    )  ;end rk_rnd-order-omn

     

    (setf mat2 '((q e5 leg e fs5 leg gs5 q a5 ten cs6 ten)
      (h cs6 leg q b5 e d6 leg cs6 leg)
      (q a5 cs6 marc+leg gs5 cs6 leg)
      (h. fs5)))

    (gen-loop 10 (rk_rnd-order-omn mat2 :seed 10 ))
    (gen-loop 10 (rk_rnd-order-omn mat2 :flat t :seed 10 ))
    (gen-loop 10 (rk_rnd-order-omn mat2 :exclude '(p ) :flat t :seed 10))

    (gen-loop 10 (rk_rnd-order-omn mat2  ))
    (gen-loop 10 (rk_rnd-order-omn mat2 :exclude '(p ) ))
    (gen-loop 10 (rk_rnd-order-omn mat2 :exclude '(l a leg) :seed 60))
    (gen-loop 10 (rk_rnd-order-omn mat2 :flat t ))
     

    ;;;;;;;;

     

    I find the results interesting to create variations with selected similarities.

     

    If there is already a function like this or another easy way to get the same results please let me know.

  2. As far as I remember a license allows you to install on two computers.

    Has that changed?

     

    It is difficult to deactivate on a broken machine. An option to deactivate all machines from one machine or from the account would make it possible to activate any new machine.

     

  3. I wrote my own little rk_omn-replace to see what could be done with :duration etc.

    Could you give an example how (rk_omn-replace :duration (rnd-sample 100 '(0.5 0.25 0.75 1.5 2)) (rnd-sample  100  mat)) could be done with dictum.

    How is :duration addressed in dictum?

     

    (defun rk_omn-replace ( type replacel omnl)
      (let* (    
           (len (omn :length omnl))
           (pit (omn :pitch omnl))
           (vel (omn :velocity omnl))
           (dur (omn :duration omnl))
           (arti (omn :articulation omnl))
           (vleg (omn :leg omnl))
           (vped (omn :ped omnl))
           (rlen (if (equal type :length)  replacel len)) 
           (rpit (if (equal type :pitch) replacel pit)) 
           (rvel (if (equal type :velocity) replacel vel)) 
           (rdur (if (equal type :duration) replacel (if (equal 0 (search len dur )) (span pit rlen) dur)))
           (rarti (if (equal type :articulation) replacel arti)) 
           (rleg (if (equal type :leg) replacel vleg)) 
           (rped (if (equal type :ped) replacel vped)) 
          )    
        (make-omn :length rlen :pitch rpit :velocity rvel :duration rdur :articulation rarti  :leg rleg :ped rped 
                  :span (if (equal type :length) :pitch :length))
      )
    )

    (setf mat1 '(e g4 f leg gs4 fs4 mf ped a4 s f4 p bb4 e4 b4 eb4 c5 d4 cs5))
    (setf mat2 '((e g4 f leg gs4 fs4 mf ped a4) (s f4 p bb4 e4 b4 eb4 c5 d4 cs5)))
    (setf mat3 '(h^e g4 f leg gs4 fs4 mf ped a4 q^s f4 p bb4 e4 b4 eb4 c5 d4 cs5))

    (setf mat mat1)

     

    (rk_omn-replace :length '(1/16 1/2 1/4 1 1/32 1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/64 1/64) mat)
    (rk_omn-replace :length '(1/16 ) mat)
    (rk_omn-replace :pitch '(c4 d4) mat)
    (rk_omn-replace :duration '(0.5 0.25 0.75 2) mat)
    (rk_omn-replace :duration (rnd-sample 100 '(0.5 0.25 0.75 1.5 2)) (rnd-sample  100  mat))
    (rk_omn-replace :duration (gen-noise 100) (rnd-sample  100  mat))
    (rk_omn-replace :articulation '(stacc pizz) mat)
    (rk_omn-replace :leg '(-1 1 -3 1) mat)
    (rk_omn-replace :ped '(1) mat)

     

     

     

     

  4. (setf mat1 '(e g4 f leg gs4 fs4 mf ped a4
                s f4 p bb4 e4 b4 eb4 c5 d4 cs5))

    (setf matz '(h^e g4 f leg gs4 fs4 mf ped a4
                q^s f4 p bb4 e4 b4 eb4 c5 d4 cs5))

    (omn :duration mat1)
    ;=>(1/8 1/8 1/8 1/8 1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16)

    (disassemble-omn mat1)
    ;=>(:length (1/8 1/8 1/8 1/8 1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16) :pitch (g4 gs4 fs4 a4 f4 bb4 e4 b4 eb4 c5 d4 cs5) :velocity (f f mf mf p p p p p p p p) :articulation (- - - - - - - - - - - -) :leg (1 -11) :ped (-2 1 -9))
    ; :duration missing


    (omn :duration matz)
    ;=>(1/8 1/2 1/2 1/2 1/16 1/4 1/4 1/4 1/4 1/4 1/4 1/4)
    (disassemble-omn matz) 
    ;=>(:length (1/2 1/2 1/2 1/2 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4) :pitch (g4 gs4 fs4 a4 f4 bb4 e4 b4 eb4 c5 d4 cs5) :velocity (f f mf mf p p p p p p p p) :duration (1/8 1/2 1/2 1/2 1/16 1/4 1/4 1/4 1/4 1/4 1/4 1/4) :articulation (- - - - - - - - - - - -) :leg (1 -11) :ped (-2 1 -9))


    (omn-replace :duration '(1/8 1/8 1/8 1/8 1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16) matz )  
    ;=> Error: There is no type named: :duration.
    ;Allowed TYPES: :length, :pitch, :velocity and :articulation

  5. I don't think it is possible  to change the midi-channel in the instrument this way.

    But what you can do is influence what events from the omn-list gets played on the instrument channel.

    There are probably better ways and this can be improved.

     

    ;; evaluate all
    ;; evaluate pattern you want to use
    ;; cmd-1 def-score
    ;; for external midi comment rk_evpos-gm and uncomment rk_evpos-extern
    
    ;; function for :omn in :instrument in def-score
    (defun events-to-ch (ch poslist omnl)
    (let* ( (somnl (single-events (flatten omnl)))
            (chplist (position-item ch poslist)))
      (loop for n from 0 to (length somnl)
            for i in somnl collect 
           (if ( equal n (car (member n chplist))) i
             (if (event-restp i) i (length-invert i))))
    ))
    
    
    (setf mat
          '((5q c4 p cs5 pp d4 p ds5 pp e4 p)
            (s f5 pp fs4 mf g4 pp gs5 mf)
            (5q a4 p as5 mf b4 mp c4 pp cs5 d4 p ds5 mf e4 mp f5 pp fs4)
            (e g4 gs5 s a4 pp e as5 mf s b4 e c4 pp s cs5 mf e d4 -q)
            (s ds5 pp e4 p f5 mp fs4 pp 3q g4 p gs5 mp
               a4 pp q as5 p 5q b4 mp c4 pp cs5 p d4 mp ds5 pp)
            (s e4 p f5 pp fs4 p g4 pp)))
    
    ;;pattern-examples for the function events-to-ch called in :omn of instrument
    ;; the numbers e.g. '(1 2 3 4) are the midi-channels
    (setf patt1 (gen-repeat 100 '(1 4)))
    (setf patt1 (gen-repeat 100 (gi '(4 1..4 2 4..1))))
    (setf patt1 (gen-repeat 100 '(2 4 3 2)))
    (setf patt1 (gen-repeat 100 (rp '((1 1) (1 2) (1 3) (1 4))))) 
    (setf patt1 (gen-repeat 100 (rp '((4 1) (3 2) (1 3) (2 4)))))
    (setf patt1 (gen-repeat 100 (rp '((4 1) (4 2) (3 3) (1 12) (1 13) (1 14)))))
    (setf patt1 (rnd-sample 500 '(1 2 3 4) :seed 300))
    (setf patt1 (rnd-sample 500 '(1 2) :seed 300))
    (setf patt1 (gen-repeat 100 '(1 2 3 4)))
    
    (def-score rk_evpos-gm
               (:title "rk_evpos_gm"
                :key-signature 'chromatic
                :time-signature '(4 4)
                :tempo 120)
    
     (instrument1 
      :omn  (events-to-ch 1 patt1 mat)
      :channel 1
      :sound 'gm
      :program 'Lead-2-Sawtooth)
    
     (instrument2 
      :omn (events-to-ch 2 patt1 mat)
      :channel 2
      :sound 'gm
      :program 'Violin)
    
     (instrument3 
      :omn  (events-to-ch 3 patt1 mat)
      :channel 3
      :sound 'gm
      :program 'Trumpet)
    
     (instrument4 
      :omn (events-to-ch 4 patt1 mat)
      :channel 4
      :sound 'gm
      :program 'Marimba)
    )
    #|
    (def-score rk_evpos-extern
               (:title "rk_evpos_extern"
                :key-signature 'chromatic
                :time-signature '(4 4)
                :tempo 120)
    
     (instrument1 
      :omn  (events-to-ch 1 patt1 mat)
      :port 0
      :channel 1)
    
     (instrument2 
      :omn (events-to-ch 2 patt1 mat)
      :port 0
      :channel 2)
    
     (instrument3 
      :omn  (events-to-ch 3 patt1 mat)
      :port 0
      :channel 3)
    
     (instrument4 
      :omn (events-to-ch 4 patt1 mat)
      :port 0
      :channel 4)
    )
    |#
    (midi-destinations)
    
    

     

  6. Aah. Get it.

    But as I get it you have to first hit cmd-1 to open a player and then Last-score->Live Coding works.

    The snippet becomes a score after being send to a Viewer.

     

    There might still be an advantage of a loop-button next to play or a checkbox in the Notation- or midi-viewer.

    In case you have a bunch of snippets in a viewer,  you could select any and play in loop .

     

     

     

     

  7. I had another look at it.

    Yes , it is a trick . But not what born wanted:

    "brownian motion to be reflected within a lower and an upper (maybe even changing) limit"

    Vector-round and vector-to-envelope2 almost ignore :amp and :output of gen-brownian-motion.

    They just squeeze and move the result.

    I understand that born wanted that when a walk goes upward to a limit it returns at the limit but keeps the :amp and :output.

    So you have a :amp 4 and you reach 5.0 you don't move above 5.0 but return.

    vector-to-envelope2 doesn't do that. But squeezes the :amps after the walk. So I think there is a difference to a tendency mask .

     

    @born: Are the solutions offered good enough or not really addressing what you wanted.

     

  8. There is a merge-voices function.

    (setf r1 '(q e e 3q 3q 3q -e. s))
    (setf r2 '(e e e. s -e e s -s s -s))
    (setf r3 (merge-voices r1 r2))
    => '(z^q c4 e e z^e e^e. s^e s 3q 3e^3q 3e^e 3q s - c4 c4)
    
    (omn :length r3)

     

    The output looks different from what you expect.  The z^ is not really documented in the omn-language-description but has to do with the :duration in make-omn. You see it in the merge-voices doc. Merge-voices is for omn-lists. It will add a c4 as default if only length are in the list.

     

    With:

    (omn :length r3)

     

    you get this: 

    (0 1/8 1/8 0 1/8 1/16 1/16 1/12 1/24 1/24 1/12 1/16 -1/16 1/16 1/16)

     

    What the 0 means I don't know.

     

  9. And another way:

    (defun chordintervals (chord &key ( named nil))
      (let* ((midimelo (pitch-to-midi (pitch-melodize chord)))
             (chordroot (first midimelo))
             (numbers (x-b midimelo chordroot))
             (names (cons 'base-note (rest (get-interval-name numbers)))))
          (if (equal named t) names numbers) ))
    
    (chordintervals '(c4d4e4g4c5))
    =>(0 2 4 7 12)
    
    (chordintervals '(c4d4e4g4c5) :named t )
    =>(base-note major-second major-third perfect-fifth perfect-octave)
    
    (chordintervals '(c4 d4 e4 g4 c5))
    =>(0 2 4 7 12)
    
    (chordintervals '(c4 d4 e4 g4 c5) :named t)
    =>(base-note major-second major-third perfect-fifth perfect-octave)

     

    I hope I understood the original post correct.

  10. Is that LISPier?  Does the same as last post.

     

    (defun chordintervals (chord)
      (let* ((midimelo (pitch-to-midi (pitch-melodize chord)))
                (chordroot (first midimelo)))
              (x-b midimelo chordroot)))

     

    (chordintervals '(c4d4e4g4c5))
    (chordintervals '(c4 d4 e4 g4 c5))
    
    both return => (0 2 4 7 12)
  11. Would this be okay, too?

     

    For getting the intervals of  notes related to the first note.

     

    (defun chordintervals (chord)
    (x-b (pitch-to-midi (pitch-melodize chord)) 
         (pitch-to-midi (first (pitch-melodize chord))))
    )

     

    melodize instead of pitch-melodize works too, but is not listed under functions.

  12. (get-count '((c4 d4 e4) (f4 g4) (a4) (b4 c5)) ) would be the same as the mapcar or mclength . 

    With :length option of get-count you can specify if you only want  to count notes or rests. 

    In this case :length :note would give the same result.

     

    There are good examples in the docs of get-count. 

    You used it in your pedal related post:

    (setf counts-notes (get-count (omn :pitch mat))). 

     

    (get-count '((c4 d4 e4) (f4 g4) (a4) (b4 c5)) )
    (mapcar 'length '((c4 d4 e4) (f4 g4) (a4) (b4 c5))).   ;That is basic from a LISP-view without knowing opusmodus.
    (mclength '((c4 d4 e4) (f4 g4) (a4) (b4 c5)))

    all return => (3 2 1 2)

     

    Have a nice Sunday 

    Rolf

  13. I just learned from your  post on another topic that there is a opusmodus-function "get-count". 

    mapcar and loop works, but "get-count" is much more flexible for opusmodus.

     

    So as I learned from you,  that is actually the right answer to the topic-question:  get-count .

     

    Just want to mention it so when someone sees the topic will get the right answer and not my previous half answer.

     

    (and there is also mclength to be found under opusmodus functions)

  14. Thanks.

    I am getting old. Have seen it before and forgotten.

    Anyway. Maybe a short mention - one sentence - in the counterpoint document before it is applied to help the newcomers and the ones that forget. 🙂 

     

    A search for 1~ or ~ doesn't find the doc. Wouldn't guess to search or 1~100 .

  15. I try to work myself through the docs of counterpoint and I encountered this:

    (setf voices
          (counterpoint (list p1 p2)
    
           '(((1 2 1 2) :methods (r - (ri dl5) (r dl2))))))
    
    (ps 'gm
        :fl (list (1~ voices))
        :cl (list (2~ voices))
        :hn (list (3~ voices))
        :vc (list (4~ voices))
        )
    
    I searched the whole documentation. There is also no mention in the book.

    Could it be included in the counterpoint document if it is specific to counterpoint ?

    Can this function be used in other contexts, too?

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy