Jump to content

Featured Replies

Posted

an idea/extension could be to "filter-events" not only by singular pitches/lengths... but also by motifs, means sequences => "filter a PATTERN" 

function-name: filter-pattern

  • Author

violà, take it as a sketch...

 

;;; like this, but the question is how to structure the input-values
;;; the kind of structure decides about output...

(defun filter-pattern (pattern omn-list)
  (progn
    (if (atom (car pattern))
      (setf pattern (mapcar #'list pattern)))
    (flatten 
     (loop 
       for i in (single-events omn-list)
       with cnt = 0
       
       when (pattern-matchp i (nth cnt pattern))
       collect i and do (incf cnt)
       else collect (neg! (omn :length i))
       
       when (= cnt (length pattern)) do (setf cnt 0)))))
  

(setf seq '(e c4 mp -e fermata e. d4 -h e. c4 e e4))


(filter-pattern (rnd-sample-seq 2 (single-events seq)) 
                '(e c4 mp -e fermata e. d4 -h e. c4 e e4))

(filter-pattern '((e. c4) (e4))
                '(e c4 mp -e fermata e. d4 -h e. c4 e e4))

(filter-pattern '((c4) (e4))
                '(e c4 mp -e fermata e. d4 -h e. c4 e e4))

(filter-pattern '(c4 e4)
                '(e c4 mp -e fermata e. d4 -h e. c4 e e4))

 

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy