Jump to content

Function to count positive rhythm values of an OMN list


Recommended Posts

Dear Friends,

 

I think a good companion to the gen-divide option to count rests would be a function that counts the positive rhythm items (the positive value attacks, excluding the pauses).

 

It would be great to calculate the size and to align rhythms and its groupings for later span processing of lists related to pitches (or any other use you might think).

 

Is there already a function like this:

 

GET-COUNT-ATTACKS

 

image.png.05b69cc6fece4c7b9ac2e6afc91c314c.png

 

(get-count-attacks '((1/8 7/8) (1/8 7/8) (1/4 1/12 1/12 1/12 3/16 5/16) (-3/8 1/8 1/4 -1/8 1/8)))

 

would return:

 

(2)(2)(7)(3) or maybe

(2 2 7 3) in flatten version

 

Best,

Julio

I think

 

(get-count omnseq :length :note)

 

do the job...

 

Best

Link to comment
Share on other sites

You can do it like that:

 

(setf len  '((1/8 7/8) (1/8 7/8) (1/4 1/12 1/12 1/12 3/16 5/16) (-3/8 1/8 1/4 -1/8 1/8)))

(setf count  (mapcar (lambda(x) (count-item 1 x)) (length-to-binary len)))

 

But you are right, we could simply do it with GET-COUNT:

 

(get-count len :length :note )

 

Best !

Stéphane

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