June 19, 20214 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, 20214 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, 20214 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
January 24Jan 24 Author This function FILTER-SET would be interesting in the core set of functions !Still coming back to this from time to time when working with pcs sets.Best !Julio
January 24Jan 24 Here’s one of my functions that I use for that:;;; FIND-PITCH-COMPLEMENT;;; ------------------------(defun find-pitch-complement (omn &key (keep-octaves nil)) "Renvoie le complement de hauteurs d'une expression omn." (do-verbose ("find-pitch-complement") (let* ((pch (ambitus '(0 11) (melodize (omn :pitch omn)))) (itg (pitch-to-integer pch)) (cpl (find-complement itg :low 0 :high 11)) (pcpl (integer-to-pitch cpl)) ) (if keep-octaves (octave-map omn pcpl) pcpl))))#| USAGE EXAMPLE(setf omn1 (length-legato (gen-filter-euclidean 12 16 7 14 (vector-to-pitch '(c4 c6)(gen-noise 32)) 's :seed 34)))(setf omn2 (make-omn :pitch (chordize (find-pitch-complement omn1)) :length (length-span (get-span omn1) '((w))) :velocity '(mf)))(ps 'gm :fl (list omn1) :pg (list omn2) )|#
Create an account or sign in to comment