JulioHerrlein Posted May 7, 2021 Posted May 7, 2021 Dear All, Is there a function for get all intervals of a row (or any list of integers or pitches) in relation to one note ? For example, given this 12 tone row: (a3 gs4 c4 d4 bb3 b3 fs4 f4 cs4 g4 ds4 e4) Get all intervals related to a4 ? The result should be: (-12 -1 -9 -7 -11 -10 -3 -4 -8 -2 -6 -5) This is for getting a resultant set of numbers related to a chromatic octave-module. Each order of the set result in a different set. Maybe can be a mapping function. Quote
AM Posted May 7, 2021 Posted May 7, 2021 (edited) (defun interval-distance (alist n) (let ((alist (if (pitchp (car alist)) (pitch-to-midi alist) alist)) (n (if (pitchp n) (pitch-to-midi n) n))) (loop for i in alist collect (- i n)))) (interval-distance '(c4 d4 b2 e7) 'c4) => (0 2 -13 40) (interval-distance '(c4 d4) 'c4) => (0 2) (interval-distance '(43 44) '41) => (2 3) (interval-distance '(56 48 11) 'c4) => (-4 -12 -49) Edited May 7, 2021 by AM Stephane Boussuge and JulioHerrlein 1 1 Quote
JulioHerrlein Posted May 7, 2021 Author Posted May 7, 2021 Great, André !! Thanks a lot ! Best ! Julio 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.