Jump to content

Recommended Posts

Posted

you can filter all events by length (>= min).

all other events will be replaced by rests...

 


(defun filter-events-by-length (omnlist &key min)
  (let ((omnlist (single-events omnlist))
        (min (car (omn :length (list min)))))
    (flatten 
     (length-rest-merge 
      (loop for i in omnlist
        when (>= (car (omn :length i)) min)
        collect i
        else collect (neg! (car (omn :length i))))))))


(filter-events-by-length '(e c4 d4 e4 e5 q c4 d4 e4 h c4 d4 e4) :min 'e)
=> (e c4 mf e d4 mf e e4 mf e e5 mf q c4 mf q d4 mf q e4 mf h c4 mf h d4 mf h e4 mf)

(filter-events-by-length '(e c4 d4 e4 e5 q c4 d4 e4 h c4 d4 e4) :min 'q)
=> (-h q c4 mf q d4 mf q e4 mf h c4 mf h d4 mf h e4 mf)

(filter-events-by-length '(e c4 d4 e4 e5 q c4 d4 e4 h c4 d4 e4) :min 'h)
=> (-wq h c4 mf h d4 mf h e4 mf)

 

 

Posted

@janusz: you could expand it with conditionals like >, <, =, span .... and implement it....

and... if you would write this function with conditionals for pitches (sequences of pitches) you could filter by vector-envelope...

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