Jump to content
Sign in to follow this  
AM

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)

 

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...