have fun!
andré
;;; TWO SIEVE-generators
;;; simple and multiple (the simple-function is part of multiple)
;;;;;;;;;;;;;;;;;;;;;;;;;
(defun gen-sieve (ambitus.omn intervals)
(midi-to-pitch
(loop
with ambitus.midi = (pitch-to-midi ambitus.omn)
with interval.cnt = -1
for pitch = (first ambitus.midi) then (setq pitch (+ (nth interval.cnt intervals) pitch))
when (<= pitch (second ambitus.midi))
collect pitch into bag
else return bag
do (incf interval.cnt)
when (= interval.cnt (length intervals))
do (setq interval.cnt 0))))
(gen-sieve '(c4 g7) '(2 1))
;;;;;;;;;;;;;;;;;;;;;;;;;
(defun gen-multiple-sieve (sieve-rules)
;sieve-rules => '((ambitus.omn intervals) (ambitus.omn intervals) (ambitus.omn intervals))
(midi-to-pitch
(sort (remove-duplicates
(loop for i in sieve-rules
append (pitch-to-midi (gen-sieve (first i) (second i)))))
#'<)))
(gen-multiple-sieve '(((c4 g7) (2 1 12))
((c1 g7) (3 5))))