Jump to content

Sorting quartertones from semitones


Recommended Posts

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:)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy