Jump to content

Featured Replies

Posted

Hi,

i've made this function for my own usage.

Sharing here if it can be useful for some others.

It is a function who replace articulation by a given one on repeated notes.

Best

SB.

 

;;; OMN-REPLACE-ARTICULATION-IF-REPEAT

(defun omn-replace-articulation-if-repeat (new-art omn-sequence)
  (do-verbose ("omn-replace-articulation-if-repeat")
  (let ((spn '())
        (res '())
        )
 (progn
   (setf spn (get-span omn-sequence))
   (setf res
   (loop for i from 0 to (- (length (flatten-sublist (single-events omn-sequence))) 1)
     collect
     (if (or 
          (eq (second (nth i (flatten-sublist (single-events omn-sequence)))) (second (nth (+ 1 i) (flatten-sublist (single-events omn-sequence)))))
          (if (>  i 0)
            (eq (second (nth i (flatten-sublist (single-events omn-sequence)))) (second (nth (- i 1) (flatten-sublist (single-events omn-sequence)))))
            )
          )
       (omn-replace :articulation new-art (nth i (flatten-sublist (single-events omn-sequence))))
       (nth i (flatten-sublist (single-events omn-sequence)))
       )))
   (length-span spn (flatten res))))))


;;; EXEMPLE
#|
(setf mat '((s c4 p leg d4 leg e4 leg f4 q g4 f marc)(s a4 mp leg g4 leg leg f4 leg e4 leg leg  leg d4 q c4 mf marc)))

(omn-replace-articulation-if-repeat '(stacc) mat)

=> '((s c4 p leg d4 leg e4 leg f4 q g4 f marc) (s a4 mp leg g4 stacc g4 stacc f4 leg e4 stacc e4 stacc e4 stacc d4 q c4 mf marc))
|#

 

 

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