greetings
andré
;;; ---------------------------------------------------------------------------------------------------
;;; because i'm working with numbered-events (to have some more control) i has to code
;;; a specific tranposition-function, which is transposing on specific spans/positions
;;; ---------------------------------------------------------------------------------------------------
;;; SUB
(defun and-span (n a b)
(and (>= n a)
(<= n b)))
;;; MAIN
(defun transpose-on-event-number (omn-list &key positions/transpose-list)
(loop
for i in (single-events omn-list)
for cnt = 0 then (incf cnt)
with position-list = (loop for x in positions/transpose-list collect (car x))
with transpose-list = (loop for y in positions/transpose-list collect (rest y))
with cnt2 = 0
when (and (and-span cnt (car (nth cnt2 position-list)) (cadr (nth cnt2 position-list)))
(not (length-restp (car (omn :length i)))))
collect (pitch-transpose-n (nth cnt2 transpose-list) i)
else collect i
when (and (= cnt (cadr (nth cnt2 position-list)))
(< cnt (cadar (last position-list))))
do (incf cnt2)))
;;; ZERO-based (like in lisp)
(transpose-on-event-number '(q g4 -q q g4 g4 g4 g4 g4 g4 g4 g4)
:positions/transpose-list '(((0 5) 1)
((6 7) -3)
((8 9) 12)))
=> ((q gs4 mf) (-q) (q gs4 mf) (q gs4 mf) (q gs4 mf) (q gs4 mf) (q e4 mf) (q e4 mf) (q g5 mf) (q g5 mf))