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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×