Posted June 19, 20213 yr Hey, people ! I´m doing a function to extract the complementary set of notes. For example: 1) Specify a set of notes, like a chord, Dm7 (setf note-list '(d5 f5 a5 c6)) Specify a tonality, like Cmajor or D dorian (same notes) (expand-tonality '(c5 major)) Now, I want a function that gives me all the other available notes from the mode, except the chord tones (the first set of notes). So, this function gives me exactly what I need (for ONE tonality at a time and ONE chord at a time): (let ((rem (expand-tonality '(c5 major))) (super (ambitus '(c5 b5) note-list))) (loop for i in super do (setf rem (remove i rem)) finally (return rem))) Ok, this give me the right result, I.E., the complementary set of notes of C major in relation to Dm7 => (e5 g5 b5) The question is simple: How can I do it for a list with many tonalities and many chords. How to do this recursively in nested lists, like (setf note-list '((d5 f5 a5 c6)(eb4 gb4 bb4 db4)(fs4 as4 cs4))) to sucessive tonalities, like: (expand-tonality '((c5 major) (db4 major) (gb4 major))) Since this WON´T work (let ((rem (ambitus '(c5 b5) (expand-tonality '((c5 major) (db5 major) (gb5 major))))) (super (ambitus '(c5 b5) '((d5 f5 a5 c6)(eb4 gb4 bb4 db4)(fs4 as4 cs4))))) (loop for i in super do (setf rem (remove i rem)) finally (return rem))) The expected result, if the above worked would be: ((e5 g5 b5) (f5 ab5 c5) (gs4 cb5 ds5)) Thanks in advance !! Best ! Julio
June 21, 20213 yr Loop in the loop: (let ((rem (ambitus '(c5 b5) (expand-tonality '((c5 major) (db5 major) (gb5 major))))) (super (ambitus '(c5 b5) '((d5 f5 a5 c6) (eb4 gb4 bb4 db4) (fs4 as4 cs4))))) (loop for s in super for r in rem collect (loop for i in s do (setf r (remove i r)) finally (return r))))
June 21, 20213 yr Author Thanks, Janusz This could implemented as a native function, like FILTER-SET A general function to filter sets out of sets. Best, Julio
Create an account or sign in to comment