Jump to content


Recommended Posts


;;; SUB -> could be replaced by an original-OPMPO-function

(defun omn-component-replace (omn-sequence replace-component)
  (make-omn :length (if (lengthp (car replace-component))
                     (append replace-component)
                     (omn :length omn-sequence))
            :pitch (if (or (pitchp (car replace-component)) (chordp (car replace-component)))
                     (append replace-component)
                     (omn :pitch omn-sequence))
            :velocity (if (velocityp (car replace-component))
                        (append replace-component)
                        (omn :velocity omn-sequence))
            :articulation (if (articulationp (car replace-component))
                            (append replace-component)
                            (omn :articulation omn-sequence))))

;;; MAIN

(defun split-chord-to-app/acc (omn-list &key (type 'app))  
  (let ((i))
    (loop  repeat (length (single-events (flatten omn-list)))
      for cnt = 0 then (incf cnt)
      do (setf i (nth cnt (single-events (flatten omn-list))))
      when (chordp (car (omn :pitch i)))
      append (append (list (append (list type) (list'e)  (butlast (melodize (car (omn :pitch i))))))
                     (omn-component-replace i (last (melodize (car (omn :pitch i))))))
      and do (incf cnt)
      and do (setf i (nth cnt (single-events (flatten omn-list))))
      else append i)))

(split-chord-to-app/acc '(e c4 ppp d4 ff pizz e4f4 g4 a4) :type 'acc)
(split-chord-to-app/acc '(e c4 ppp d4 ff pizz e4f4 g4 a4) :type 'app)

(split-chord-to-app/acc '(e c4 ppp d4 ff pizz e4f4c5 g4 a4) :type 'acc)
(split-chord-to-app/acc '(e c4 ppp d4 ff pizz e4f4c5 g4 a4) :type 'app)


Edited by AM
added subfunction
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use Privacy Policy