AM Posted June 22, 2017 Posted June 22, 2017 (edited) ;;; 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 ;;; FUNCTION (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))))) (progn (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))))) ;;; EXAMPLES: (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 June 23, 2017 by AM bug fixed Stephane Boussuge 1 Quote
Stephane Boussuge Posted June 23, 2017 Posted June 23, 2017 Hi, could be also useful for counterpoint ! Great ! S. Quote
AM Posted June 23, 2017 Author Posted June 23, 2017 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" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.