Jump to content


Recommended Posts

bad coding-style, but a useful function -> implement in OM?

all the best



(defun filter-pitches-octave-independent (pitches filter-pitch &key (bandwith 10))
  (let ((search-field (loop for j in filter-pitch
                        append (append
                                (reverse (loop repeat (/ bandwith 2)
                                           with p1 = (pitch-to-midi j)
                                           collect (setq p1 (- p1 12))))
                                (list (pitch-to-midi j))
                                (loop repeat (/ bandwith 2)
                                  with p2 = (pitch-to-midi j)
                                  collect (setq p2 (+ p2 12)))))))
    (loop for i in (pitch-to-midi pitches)
      when (not (null (member i search-field)))
      collect (midi-to-pitch i))))

(filter-pitches-octave-independent '(c4 d4 e6)  '(d3 c1))
=> (c4 d4)


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.

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