Skip to content
View in the app

A better way to browse. Learn more.

Learn more

omn-replace-articulation-if-repeat

Featured Replies

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

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.