December 4, 20169 yr Can't find the Opusmodus function to do the following: input: '(c4 e4 g4 bb4 c5) input: '(0 127) -> from - to range in midi note numbers output:'(c-1 e-1 g-1 bb-1 c0 e0 g0 bb0 c1 e1 g1 bb1 c2 e2 g2 bb2 ... c9 e9 g9) Many thanks in advance :-)
December 4, 20169 yr (gen-sieve '(c0 c9) (pitch-to-interval '(c4 e4 g4 bb4 c5)) :type :pitch) (gen-sieve (midi-to-pitch '(12 127)) (pitch-to-interval '(c4 e4 g4 bb4 c5)) :type :pitch) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; putted in a little function ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun gen-sequence (pitch-sequence midi-ambitus) (gen-sieve (midi-to-pitch midi-ambitus) (pitch-to-interval pitch-sequence) :type :pitch)) ;; eval (gen-sequence '(c4 e4 g4 bb4 c5) '(12 127)) ;; => (c0 e0 g0 bb0 c1 e1 g1 bb1 c2 e2 g2 bb2 c3 e3 g3 bb3 c4 e4 g4 bb4 c5 e5 g5 bb5 c6 e6 g6 bb6 c7 e7 g7 bb7 c8 e8 g8 bb8 c9 e9 g9)
December 4, 20169 yr version in (almost) pure lisp (only "midi-to-pitch" is OM) (defun gen-sieve-userdefined (ambitus.midi intervals) (midi-to-pitch (loop 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-userdefined '(12 72) '(4 2 3))
Create an account or sign in to comment