JulioHerrlein Posted March 5 Share Posted March 5 Dear All, One interesting conversion would be the one for transforming the get-time-signature result to length-span time signature format. This would be useful to rephrase rhythmically one rhythm with another´s rhythm time-signature structure. For example: ; Take this rhythm (setf ritmos (gen-repeat 4 (gen-length '((1 2 1 2 1 1) (1 1 1 1 1 2 1) (1 -3 1 -3 2 -2 4) (-3 1 -1 1 1 1)) '(16)))) Here is the bar structure for this (get-time-signature ritmos) This is the output ((2 4 2) (4 4 1) (2 4 3) (4 4 1) (2 4 3) (4 4 1) (2 4 3) (4 4 1) (2 4 1)) If I want to use this result as a time signature template in the length-span I have to convert it to (2/4 2/4 1 2/4 2/4 2/4 1 2/4 2/4 2/4 1 2/4 2/4 2/4 1 2/4) in order to use the time-signature order it in the length-span function Is there some function that performs this ? Best ! Julio I did this extravagant coding , but I need it with the slashes ( " / " ) and the repetitions, like converting (2 4 3) into (2/4 2/4 2/4)... (setf timesig-to-length-span (flatten (matrix-transpose (list (lake-everyother (get-count (get-count (get-time-signature ritmos))) ; how many 0 3 (flatten (get-time-signature ritmos))) (lake-everyother (get-count (get-count (get-time-signature ritmos))) ; how many 1 3 (flatten (get-time-signature ritmos))) ) )) ) ;;(2 4 4 4 2 4) I love lake-everyother Quote Link to comment Share on other sites More sharing options...
jesele Posted March 6 Share Posted March 6 Hi Julio. Maybe something like this will work. Jesper (setf tst '((2 4 2) (4 4 1) (2 4 3) (4 4 1) (2 4 3) (4 4 1) (2 4 3) (4 4 1) (2 4 1))) (defun foo (lst) (flatten (loop for x in lst collect (make-list (caddr x) :initial-element (/ (car x) (cadr x))))) ) (foo tst) ->(1/2 1/2 1 1/2 1/2 1/2 1 1/2 1/2 1/2 1 1/2 1/2 1/2 1 1/2) JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted March 6 Share Posted March 6 Hi Julio, you can use get-span function: (setf ritmos (gen-repeat 4 (gen-length '((1 2 1 2 1 1) (1 1 1 1 1 2 1) (1 -3 1 -3 2 -2 4) (-3 1 -1 1 1 1)) '(16)))) (get-span ritmos) => (1/2 1/2 1 1/2 1/2 1/2 1 1/2 1/2 1/2 1 1/2 1/2 1/2 1 1/2) S. JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
jesele Posted March 6 Share Posted March 6 Yup, that avoids one step, Stephane. I have to study the built-in functions some more. Jesper Stephane Boussuge 1 Quote Link to comment Share on other sites More sharing options...
jesele Posted March 6 Share Posted March 6 Or (mapcar (lambda (x) (sum (mapcar 'abs x))) ritmos) Jesper JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 6 Author Share Posted March 6 Thanks a lot Stephane and Jesper ! Best ! 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.