Jump to content

change-time-structures


Recommended Posts

;;; CHANGE-TIME-STRUCTURES
;;; works okay, but not exactly precise because of rhy-to-integer, which is not very easy in some cases

;;; this function changes basic-rhy-structures (if it's all the time perhaps in x/32) 
;;; to other/changing sections. the lengths/rests will be rounded like in LENGTH-RATIONAL-QUANTIZE

;;; rhy+span => '((32 2) (44 7)) => means in 32 three values, in 44 seven values

(defun change-time-structure (omnseq rhy+span &key (basic-rhy 32) (round 1/4))
  (let* ((intseq (loop for i in (omn :length (flatten omnseq))
                   collect (* i basic-rhy)))
         (rhyseq (mapcar #'car rhy+span))
         (spanseq (mapcar #'cadr rhy+span))
         (divided-intseq (gen-divide spanseq intseq)))

    (length-rational-quantize (flatten (gen-length divided-intseq rhyseq)) :round round)))




(change-time-structure '(2/44 -2/44 3/44 5/44 6/44) '((32 2) (20 2) (28 3)) :basic-rhy 44)
=> (1/16 -1/16 -1/8 3/20 1/4 -1/10 3/14 -1/28)

(change-time-structure '(2/32 -2/32 3/32 5/32 6/32) '((20 2) (44 2) (28 3)) :basic-rhy 32)
=> (1/10 -1/10 -1/20 3/44 5/44 -3/44 3/14 -1/28)

 

could be done better -> go for it 🙂

greetings

andré

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