Andersskibsted Posted December 18, 2023 Share Posted December 18, 2023 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 Quote Link to comment Share on other sites More sharing options...
vpolajnar Posted December 18, 2023 Share Posted December 18, 2023 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:) Stephane Boussuge 1 Quote Link to comment Share on other sites More sharing options...
Andersskibsted Posted December 18, 2023 Author Share Posted December 18, 2023 Very useful. Thank you for your help, this is more or less exactly what I needed. Quote Link to comment Share on other sites More sharing options...
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.