Posted July 20, 2024Jul 20 Hello, If I have a list like ( (c4) (cs4d4) (f4) (e4fs4) ), I'd like to modify just the chord sublists so that it shows the root and all inversions of the chord. If I do (chord-inversion 1 '((c4) (cs4d4) (f4) (e4fs4)) :series t :root t ) , I get (((c4) c4) ((cs4d4) d4cs5) ((f4) f4) ((e4fs4) fs4e5)) but I'd want the chord-inversion function to ignore the single note sublists ( e.g. (c4) ) since they aren't chords. So, how would I get a result similar to the below? ( (c4) (cs4d4 d4cs5) (f4) (e4fs4 fs4e5) ) Also, is there a way to identify which sublists have a chord versus just a single note? Thanks for any info!
July 21, 2024Jul 21 Loop iteration is one of the most powerful and useful functions in environments like Opusmodus. I recommend spending some time understanding the grammar of the iteration possibilities. loop for i in '((c4) (cs4d4) (f4) (e4fs4)) collect (flatten (filter-repeat 1 (chord-inversion 1 i :series t :root t)))) => ((c4) (cs4d4 d4cs5) (f4) (e4fs4 fs4e5)) It would be better to flatten the sequence first: (flatten (loop for i in '(c4 cs4d4 f4 e4fs4) collect (filter-repeat 1 (chord-inversion 1 i :series t :root t)))) => (c4 cs4d4 d4cs5 f4 e4fs4 fs4e5) I could modify the function to prevent single pitch repetitions. With the possibile change: (chord-inversion 1 '(c4 cs4d4 f4 e4fs4) :series t :root t) => ((c4) (cs4d4 d4cs5) (f4) (e4fs4 fs4e5))
July 21, 2024Jul 21 Author Thanks much! Yes, I think I need to spend some time learning more about Common Lisp. For the chord-inversion function, it does seem like it should ignore single notes. Also, when looping through or processing a list, is there a function for checking whether an item is a chord or not, e.g. if ( is-chord item ) ? I can see how that could be useful for deciding whether to take action on an item in a list.
July 21, 2024Jul 21 Author 31 minutes ago, jesele said: chordp Jesper Ah thank you. In the docs, what folder is that under? For chord related stuff, I usually look in /Pitches/Chords but didn't see it there.
Create an account or sign in to comment