NagyMusic Posted March 17, 2022 Share Posted March 17, 2022 Does anyone know if there's a function that outputs a number of beats from every measure in an omn sequence, given the denominator? For example with the eighth-note denominator, ((-e a3f4d5 q f4d5a5) (q a3e4c5 q e4c5a5) (-e a3g4e5 h g4e5a5)) would output (3, 4, 5). Thank you! Quote Link to comment Share on other sites More sharing options...
AM Posted March 18, 2022 Share Posted March 18, 2022 violà... here's a solution... but: you have a wrong OMN-structure in your code (-e a3f4d5 q ... => a rest followed by a pitch, i corrected it (setf omnlist '((-e q f4d5a5) (q a3e4c5 q e4c5a5) (-e h g4e5a5))) (defun countbeats (omnlist &key (denom '1/8)) (loop for i in omnlist collect (/ (sum (abs! (flatten (omn :length i)))) denom))) (countbeats omnlist) => (3 4 5) (countbeats omnlist :denom 1/16) => (6 8 10) Stephane Boussuge and NagyMusic 1 1 Quote Link to comment Share on other sites More sharing options...
o_e Posted March 18, 2022 Share Posted March 18, 2022 @André: isnt it so, that the length value is valid until the next length value regardless if its a rest or not? Please correct me if I'am wrong.. (omn :length '((-e a3f4d5 q f4d5a5) (q a3e4c5 q e4c5a5) (-e a3g4e5 h g4e5a5))) ==>((-1/8 1/8 1/4) (1/4 1/4) (-1/8 1/8 1/2)) Quote Link to comment Share on other sites More sharing options...
AM Posted March 18, 2022 Share Posted March 18, 2022 yes, but it's - in my opinion - not very clear like that. difference: what you see and... what you get... i always write it like this: '((-e e a3f4d5 q f4d5a5) (q a3e4c5 q e4c5a5) (-e e a3g4e5 h g4e5a5))) it makes more practical sense to me ... but my functions works for BOTH Quote Link to comment Share on other sites More sharing options...
opmo Posted March 18, 2022 Share Posted March 18, 2022 (setf mat '((-e a3f4d5 q f4d5a5) (q a3e4c5 q e4c5a5) (-e a3g4e5 h g4e5a5))) (get-time-signature mat) => ((2 4 2) (3 4 1)) (get-time-signature mat :group :numerator) => (((2) 4 2) ((3) 4 1)) (get-time-signature mat :group :denominator) => (((1 1) 4 2) ((1 1 1) 4 1)) (get-span mat) => (1/2 1/2 3/4) Quote Link to comment Share on other sites More sharing options...
NagyMusic Posted March 18, 2022 Author Share Posted March 18, 2022 Thank you, all! This is very helpful. The AM solution gave me what I was looking for. 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.