< Back to IRCAM Forum

Counting Element Occurrences

Hi,

I’m very new to Open Music, having begun using it after becoming proficient in Pure Data. I know this probably has a very simple solution, but I’m trying to take a list of midicent values generated from partial tracking into a chord sequence and see how many times each midicent value occurs/probability of a midicent value. I know how to get Open Music to count all of the elements, but I don’t know how to get it to return a list of the occurrences of each separate value.

Thanks in advance.

Hi MSYTSMOO

here is a patch with an example of random numbers. (for chord-seqm juste flatten your lmidic list using ‘flat’ ),
it outputs a sorted list of list with ((elmt times-of-occurence) …)

Hope this will helps.

best
K

count-occurences.omp (7.12 KB)

Thanks Karim,

It’s a great starting point. Either my sample size is too large or I’ve done something wrong because I’m getting a lot of long error messages containing lots of numbers, but I think I can figure the rest of what I need out based on what you’ve posted.

JS

Hi,

Here’s another way. You can switch the “times” and “elements” connections of [list] according to your needs.
Does it work with your chord-seq?

Best,
RC

Screenshot.png