What is the DTW result (applied to the MFCCs of an audio file) proportional to? I have computed the MFCCs for two audio files and applied the DTW to both sets of coeficients for both files. Now each such pair the two files is described by one single value (computed by the DTW). Let's call this value Diff.

If the audio files differ more, then Diff is greater, which is great. (so Diff is proportional to the difference between the audio signals - great!).

My problem is that Diff seems to be also proportional to the length of the files (?). Therefore, for two similar long audio signals, Diff might be greater than for two different short signals.

First I thought that, as DTW computes the shortest path for two arrays, the final value should be proportional to the lenght of the two arrays (i.e. the number of frames for each of the signals). So I tried dividing it by the product and by the average of the two lenghts but the results was discouraging (too big for some files that did not differ so much, too small for others).

Then I thought that if it is proportional to the lenght of the files, then dividing it to the average number of frames (in which I divided the two signals for computing the MFCCs) would do the trick... but it didn't...

Finally, I thought that, as the MFCCs are computed from the result of the FFT, the final DTW result might be proportional to the sum of the FFT magnitudes, so I tried dividing it by this sum (of the spectrum elements, returned by the FFT algorithm). Again, the results were not what I hoped them to be...

Right now I'm out of ideas... What is the DTW result depending on, what is it proportional to?



EDIT:
Here are some values, after pichenettes' suggestion to try the geometric average of the lengths of the files:


same sound . avgLengths = 106000. Diff = 409. Diff / avgLengths = 38
same sound . avgLengths = 191000. Diff = 609. Diff / avgLengths = 31
diff sounds. avgLengths =  80000. Diff = 437. Diff / avgLengths = 55
diff sounds. avgLengths = 193000. Diff = 692. Diff / avgLengths = 35


38 > 35 :(

(the sounds from 2. and 4. are almost similar, and so are the ones from 1. and 3. In 1. the trailing silence for one file is a little longer)
DTW is not proportional to anything, including frame length. It's not a good idea to compare DTW values between two different pairs like you are doing.

The issue is that DTW is not just the number but also an alignment. If alignment does not match, you can not relate numbers. You only can relate numbers if you align to the same thing.

Normalization is often suggested, but mathematically it doesn't have much sense.

In classical tasks like speech recognition you never compare the DTW values between pairs, instead, you compare a sample to several templates and find the best one. The fact that you try to match to same sample allows you to compare DTW values. In keyword spotting using DTW the threshold must depend on every template you are matching, you can not use single threshold for all the templates. Even more, for the two different templates of the same length DTW thresholds must be different.