Jump to content

omn-sieve-filter


Recommended Posts

(defun memberp (n liste)
  (not (equal 'nil (member n liste))))

;;; MAIN

(defun omn-sieve-filter (omn-list filter-list)
  (flatten 
   (loop 
     for i in (single-events omn-list)
     for j from 1 to (length omn-list)
     when (memberp j filter-list)
     collect i
     else collect (length-invert (car i)))))


(omn-sieve-filter (make-omn :pitch (rnd-sample 10 '(c4 d4 e4 fs4 gs4) :seed 89)
                        :length '(e)
                        :span :pitch)
                  '(1 2 3 5 8 9 10))

=> (e c4 mf e gs4 mf e fs4 mf -1/8 e e4 mf -1/8 -1/8 e c4 mf e gs4 mf e fs4 mf)

 

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.

Guest
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