Jump to content

Featured Replies

Posted

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

all the best

andré

 

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

 

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy