Jump to content

get-position (add for "inserting-on..."-function

Recommended Posts

;;; gets the position => bar and beat where the value is
;;; => could be used in combination with "inserting-on-bar/beat*",
;;; if you are looking for a specific value to sprout a sequqnce


(defun get-position (seq value &key (get 'all))
  (let ((beat)
        (bar (car
              (loop for i in seq
                for bar = 1 then (incf bar)
                append (loop for j in (single-events i)
                         when (pattern-matchp j (list value))
                         collect bar)))))
      (setf beat (loop for k in (loop for i in (single-events (nth (1- bar) seq))
                                  when (not (pattern-matchp i (list value)))
                                  append (omn :length i)
                                  else collect 'match)
                   when (numberp k)
                   collect (abs k) into bag
                   when (equal k 'match)
                   do (return (list (1+ (numerator (abs (sum bag))))
                                    (denominator (abs (sum bag))))))))
    (cond ((equal get 'all)
           (list bar beat))
          ((equal get 'bar)
           (append bar))
          ((equal get 'beat)
           (append beat)))))


(setf seq '((h c4 q q) (e f4 pp f4 mp f4) (-3q 3q cs5 -3q h)))

(get-position seq 'cs5 :get 'all)
(get-position seq 'cs5 :get 'bar)
(get-position seq 'cs5 :get 'beat)

(get-position seq 'pp :get 'all)


Edited by AM
bug fixed
Link to comment
Share on other sites

hi, yes - with this two functions (get-posititon & inserting-on-bar/beat*) you will have a lot of possibilities...


1) post-processing an OMN without changing the global time structure

2) working with "strukturnetze" (lachenmann)

3) countrepoints

4) idea of palimpsts



...so, perhaps OPMO could code it smarter then me (that's not complicated :-))?

... i try to do an example today with something like a "strukturnetz"

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

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