AM Posted September 16, 2017 Share Posted September 16, 2017 two functions i needed for working with POLYTEMPO-NETWORK http://philippekocher.ch/#109 http://polytempo.zhdk.ch greetings andré (defun length-to-decimal (alist &key (sum nil)) (let ((list (loop for i in (omn :length alist) collect (float (* i 4))))) (if (equal sum t) (sum list) list))) ;;; result: q = 1 / h. = 3 ...etc... (length-to-decimal '(h. h. 3q 5e 3h)) => (3.0 3.0 0.33333334 0.1 0.6666667) (length-to-decimal '(h. h. 3q 5e 3h) :sum t) => 7.1 (defun length-to-sec (alist tempo &key (sum nil)) (let ((list (loop for i in (omn :length alist) collect (* (/ 60 tempo) (float (* i 4)))))) (if (equal sum t) (sum list) list))) (length-to-sec '(h. h. 3q 5e 3h) 60) => (3.0 3.0 0.33333334 0.1 0.6666667) (length-to-sec '(h. h. 3q 5e 3h) 51) => (3.5294118 3.5294118 0.3921569 0.11764707 0.7843138) (length-to-sec '(h. h. 3q 5e 3h) 51 :sum t) => 8.3529415 loopyc 1 Quote Link to comment Share on other sites More sharing options...
opmo Posted September 16, 2017 Share Posted September 16, 2017 I used this function for conversion of 4 instrument each with in its own tempo to one 'global' tempo. Examples: (length-tempo-map 72 36 '1/4) => 1/2 (length-tempo-map 72 36 'w) => 2 (length-tempo-map 72 88 '(1/8 1/4 -1/4)) => (9/88 9/44 -9/44) (length-tempo-map 72 '(120 36) '((1/8 1/4 -1/4) (1/16 1/8 -1/4 1/1))) => ((3/40 3/20 -3/20) (1/8 1/4 -1/2 2)) (length-tempo-map 72 '(36 96 72) '((1/20 1/20 1/20 1/20 1/20) (1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16) (1/8 1/8 1/8 1/8) (1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4)) :meter '(1 1 1)) => ((1/10 1/10 1/10 1/10 1/10) (1/8 1/8 1/8 1/8 1/8 1/8 1/8 1/8) (1/4 1/4 3/32 3/32) (3/16 3/16 3/16 1/4 1/4 1/4 1/4 1/2)) (length-tempo-map 72 36 '((e c4 e4 g4 h_e c5) (q c4 = = - - =) (q cs5 = - - = =))) => ((q c4 e4 g4 w_q c5) (h c4 = = - - =) (h cs5 = - - = =)) (length-tempo-map 72 '(36 96 72) '((e c4 e4 g4 h_e c5) (q c4 = = - - =) (q cs5 = - - = =)) :meter '(1 1 1)) => ((q c4 e4 g4 w_q c5) (e. c4 = = - -q =) (q cs5 = -h - = =)) loopyc 1 Quote Link to comment Share on other sites More sharing options...
loopyc Posted July 4, 2018 Share Posted July 4, 2018 Janusz, where is this above function 'length-tempo-map'? It doesn't appear to be part of system and system/forum searches only come up with this one reference? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
AM Posted July 4, 2018 Author Share Posted July 4, 2018 function name changed to length-to-tempo. Quote Link to comment Share on other sites More sharing options...
opmo Posted July 4, 2018 Share Posted July 4, 2018 The new name is length-to-tempo - for some time Quote Link to comment Share on other sites More sharing options...
loopyc Posted July 5, 2018 Share Posted July 5, 2018 Thank you for the info and replies ;-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.