Jump to content

Featured Replies

Posted
;;; removes pitches by its position-number, will be replaced by rests. (starts with 0)

(defun omn-pitch-position-remove (positions omnseq)
  (length-rest-merge (loop for i in (single-events omnseq)
                       with cnt = 0
                       
                       when (and (pitchp (cadr i)) 
                                 (not (equal 'nil (member cnt positions))))
                       append (make-omn :length (list (length-invert (car i))))
                       else append i
                       
                       when (pitchp (cadr i))
                       do (incf cnt))))


(omn-pitch-position-remove '(0 1) '(-q e c4 e d4 e e4 e e e e))
=> (-h e e4 mf e4 e4 e4 e4)

(omn-pitch-position-remove '(2 4) '(-q e c4 e d4 e e4 e e e e))
=> (-q e c4 mf d4 - e4 - e4 e4)

or more common

 



(defun omn-position-remove (positions omnseq &key (type 'pitch))
  (length-rest-merge (loop for i in (single-events omnseq)
                       with cnt = 0
                       
                       when (and (cond ((equal type 'pitch)
                                        (pitchp (cadr i)))
                                       ((equal type 'length)
                                        (lengthp (car i))))                                     
                                 (not (equal 'nil (member cnt positions))))

                       append (make-omn :length (list (length-invert (car i))))
                       else append i
                       
                       when (cond ((equal type 'pitch)
                                   (pitchp (cadr i)))
                                  ((equal type 'length)
                                   (lengthp (car i))))
                       do (incf cnt))))

(omn-position-remove '(2 4) '(-q e c4 e d4 e e4 e e e e) :type 'pitch)
=> (-q e c4 mf d4 - e4 - e4 e4)

(omn-position-remove '(0 4) '(e c4 e d4 e e4 e e e e) :type 'length)
=> (-e d4 mf e4 e4 - e4 e4)

could be also extended for articulation/velocity

 

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