Skip to content
View in the app

A better way to browse. Learn more.

Learn more

omn-pitch-position-remove / omn-position-remove

Featured Replies

;;; 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

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.