calculate how similar two lists are
I’d like to calculate how similar two lists are.
the background: I save all the frequency peaks of a piano-chord in a list. Whenever I play a new chord I want to compare the new frequency peaks with the old ones to find out, whether the chord is the same.
Of course the values (which means overtones and their amplitude) would never be exaclty the same. Just similar.
Could anyone please give me a hint what which I could go?
"how similar" and "the same or not" are two different things.
to compare 2 lists there is [zl] – in max 5 i *think* it takes "compare" as
what also works, and what i do since many years, it to convert a list to
a symbol – "60 64 67" – and then compare that using [zl union].
that’s that I mean: I can easily find out, which values are exactly the same. But I need a measure for similarness.
Let’s say the first chord has a peak at 442 Hz with a certain amplitude.
The next chord has a peak at 443 Hz and a little louder. It’s still the same overtone as the values are very close to each other.
Now imagine you have a chord with 10 overtone-peaks. If I compare all the peaks I’d like to get a value of e.g. 90% similarness – so it’s the same chord.
Do you understand?
zsa.dist is doing all the work. What’s the fun of that?-)
There are a couple of possible definitions of "similarity" for lists. In your case root-mean-square might be meaningful, and is relatively straight-forward to evaluate with, say, [vexpr].
(let my first correct myself: of course i dont convert lists to symbols in
order to compare, thats bullshit. i do it the other was round!)
"The next chord has a peak at 443 Hz and a little louder"
yes, i understand now. i think what you want is simply to quantize and
truncate your freuquency data.
first of all please convert all your frequencies from Hz to note numbers
(midi note numbers – but in floating point).
note numbers are linear, and that makes thing so much easier to understand
and to calculate!
442 and 443 Hz will than be something like note number 59.9 and 59.94,
and you can make up all kinds of tests against other notes.
you could truncate to integer, so that both values will be converted to 60.0
and if you compare they wil now be "the same".
or you could make up a custom rule saying that everything between a
difference of 0.001 – 0.1 is "very similar" and from "0.1 – 0.33" you call it "similar".
thank you guys,
Right now I’m focusing the transcribe~-algorhythm as this is pretty the same idea I had in mind.
Unfortunately the transcribe~-external crashes my M4L so I will have to rewrite it.
I’m studying the ftm-library and the paper arhsia cont wrote:
But as I studied music instead of maths I don’t understand how "Non-negative Matrix Factorization" and "Sparseness constraints" works…