Jump to content

merge-lengths-of-a-pitch-rep


Recommended Posts

works, but only for one-time-repetiton... could you use it?

 

(defun merge-lengths-of-a-pitch-rep (omn-seq)
  (let* ((omn-seq (single-events omn-seq)) (l))
    (flatten (loop repeat (length omn-seq)
               for cnt = 0 then (incf cnt)
               
               when (equal (omn :pitch (nth cnt omn-seq)) (omn :pitch (nth (1+ cnt) omn-seq)))
               do (progn 
                    (setf l (length-note-merge (append (omn :length (nth cnt omn-seq)) (omn :length  (nth (1+ cnt) omn-seq)))))
                    (incf cnt))
               and collect (omn-replace :length l (nth cnt omn-seq))
               else collect  (nth cnt omn-seq)))))
  
(merge-lengths-of-a-pitch-rep '(e c4 mf d4 d4 e4 f4 f4))
=> (e c4 mf q d4 mf e e4 mf q f4 mf)

 

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.

Guest
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