Jump to content
Sign in to follow this  
AM

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é

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×