Jump to content


Recommended Posts

a sieve/filter-function - filters specific INTERVALS and replacing the others by rests.

(don't work perfect, but as a sketch....)




(defun equal/or (n alist)
  (car (loop for i in alist
         when (equal i n) collect 't)))


(defun filter-omn-by-intervals (omn-seq intervals)
  (setf omn-seq
        with omn-events = (single-events omn-seq)
        with i = 0
        while (not (null (nth i omn-events)))

        when (equal/or (car (pitch-to-interval (append (omn :pitch (nth i omn-events))
                                                (omn :pitch (nth (1+ i) omn-events)))))
        collect  (list (nth i omn-events) (nth (1+ i) omn-events))
        and do (incf i 2)
        else collect (neg! (car (omn :length (nth i omn-events))))
        and do (incf i))))


(setf basic-omn-seq (make-omn :pitch (vector-to-pitch '(c4 c6)
                                                      (gen-white-noise 100 :type :logistic))
                              :length '(t)
                              :span :pitch))

;;; check out all these filter-tests
(setf omn-seq (filter-omn-by-intervals basic-omn-seq '(1 2 3)))
;(setf omn-seq (filter-omn-by-intervals basic-omn-seq '(3 -3)))
;(setf omn-seq (filter-omn-by-intervals basic-omn-seq '(1 -1 5 -5 7 -7)))

(def-score example
           (:title "example"
                   :key-signature 'atonal  
                   :time-signature '(4 4) 
                   :tempo 90) 
   :omn (flatten omn-seq)
   :channel 1
   :sound 'gm-piano)

   :omn (flatten basic-omn-seq)
   :velocity 20
   :channel 3
   :sound 'gm-piano))



here is a more complex example


(defvar library)
(defvar abfolge)
(defvar omn-seq)
(defvar rhy)
(defvar field)

;;;library + rhy --------------------------------------------------------------------------------
(setf rhy 44)
(setf library (list '(eb5 5 p mute)
                    '(e4 5 mf mute)
                    '(gs4 3 f mute)
                    '(g5 3 ppp mute)
                    '(f6 2 p mute)
                    '(cs4 1 f mute)
                    '(d5 1 fff mute)
                    '(b3 4 pppp mute)
                    '(bb5 4 mp mute)
                    '(a4 3 pp mute)
                    '(fs3 (2 7) ppp mute)
                    '(c6 (1 11) mp mute)))

(setf library 
      (loop for i in library 
        collect (append (list (car i)) (if (listp (cadr i))
                                         (gen-length (list (rnd-pick (cadr i))) rhy)
                                         (gen-length (list (cadr i)) rhy))
                        (filter-last 2 i))))

;;; gen seq from library/abfolge---------------------------------------------------------------

(setf field '(eb5 e4 gs4 g5 f6 cs4 d5 b3 bb5 a4 fs3 c6))

(setf abfolge (pick-norepeat 500 field))

(setf omn-seq (loop for x in abfolge 
                with y 
                do (setf y (assoc x library))
                append (append (reverse (filter-first 2 y)) (filter-last 2 y))))

(setf basic-omn-seq omn-seq)

(setf omn-seq (filter-omn-by-intervals basic-omn-seq 
                                       '(1 -1 11 -11 13 -13
                                         4 -4 8 -8 16 -16 20 -20 28 -28 32 -32
                                         7 -7 19 -19)))


(def-score example2
           (:title "example2"
                   :key-signature 'atonal  
                   :time-signature '(4 4) 
                   :tempo 90) 
   :omn (flatten omn-seq)
   :channel 1
   :sound 'gm-piano)

   :omn (flatten basic-omn-seq)
   :channel 1
   :velocity 0
   :sound 'gm-piano))


(omn-list-plot (flatten omn-seq) :join-points t)


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use Privacy Policy