Jump to content
Sign in to follow this  
AM

why a alternative version of LENGTH-INVERT is useful

Recommended Posts

i coded a new/alternative version of LENGTH-INVERT. i used it for a so called BINARY-FILTER (for events) - have a look to the example and you see the reason.

in some cases you will have a much better DISPLAY/SCORE, is there an OPMO version for that?

 

greetings

andré

 

;;; --------------------------------------------------------
;;; VERSION WITH OPMO length-invert
;;; --------------------------------------------------------

(defun binary-filter-old (alist bin-list)
  (let ((event-list (cond ((omn-formp alist)
                           (single-events alist))
                          (t alist))))
    (flatten 
     (loop 
       for i in event-list
       for j in bin-list
       when (= j 1)
       collect i
       else append (list (length-invert (car i)))))))


;;; --------------------------------------------------------
;;; VERSION WITH OWN length-invert
;;; --------------------------------------------------------

(defun binary-filter* (alist bin-list)
  (let ((event-list (cond ((omn-formp alist)
                           (single-events alist))
                          (t alist))))
     (flatten 
      (loop 
        for i in event-list
        for j in bin-list
        when (= j 1)
        collect i
        else append (list (length-invert** (car i)))))))
         
(defun length-invert** (length-val)
  (append (compress (list '- length-val))))   

 

 

EXAMPLE WITH THE ORIGINAL VERSION:

 


;;; EXAMPLE => complex rhythms 

(setf omn-seq (make-omn :length '(t s t 3q 3e_s. t 5h 5h 5q_7q 7q 7q 7q 7q 7q 7q_5q 5h 5h t s._3e 3q t s t)
                        :pitch '(a4)))


;;; when you use my BINARY-FILTER_OLD which has the OPMO length-invert you will get a strange display-result (looks bad)
;; have a look with cmd3

(binary-filter-old omn-seq '(0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1))

=> (-1/32 s a4 mf -1/32 3q a4 mf -13/96 t a4 mf -1/10 5h a4 mf -3/35 7q a4 mf -1/28 7q a4 mf -1/28 7q a4 mf 7q_5q a4 mf 5h a4 mf 5h a4 mf t a4 mf s._3e a4 mf 3q a4 mf)

old.jpeg

 

 

 

EXAMPLE WITH USING THE ALTERNATIVE VERSION:

 

;;; EXAMPLE => complex rhythms 
(setf omn-seq (make-omn :length '(t s t 3q 3e_s. t 5h 5h 5q_7q 7q 7q 7q 7q 7q 7q_5q 5h 5h t s._3e 3q t s t)
                        :pitch '(a4)))

;;; when you use the new BINARY-FILTER with the new length-invert**
;; have a look with cmd3

(binary-filter* omn-seq '(0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1))

=> (-t s a4 mf -t 3q a4 mf -3e_s. t a4 mf -5h 5h a4 mf -5q_7q 7q a4 mf -7q 7q a4 mf -7q 7q a4 mf 7q_5q a4 mf 5h a4 mf 5h a4 mf t a4 mf s._3e a4 mf 3q a4 mf)

;;; you see the FORMAT (-3e_s.) didn't changed in the rests (not -13/96), so it will be displayed well

new.jpeg

 

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  

×