Posted December 18, 20231 yr Hi, Does anyone know of a good way to sort a list of pitches so I get a list of all the quartertones and another list of all the semitones? Or maybe a function that tests if a pitch is within the twelve semitones or not? Thank you Anders
December 18, 20231 yr one solution: (defun split-decimals-and-wholes (lst) "Splits the given list into two sublists: one with decimal numbers and one with whole numbers." (midi-to-pitch (loop for number in (pitch-to-midi lst) if (equal (round number) number) collect number into wholes else collect number into decimals finally (return (list decimals wholes)))) ) ;; Example usage: (setf pitches '(c4 c4+ cs4 cs4+ d4 d4+ eb4 eb4+)) (split-decimals-and-wholes pitches) you can maybe provide what exactly output you need:)
December 18, 20231 yr Author Very useful. Thank you for your help, this is more or less exactly what I needed.
Create an account or sign in to comment