Mfcc comparison

I have been working over the past days to compare mfcc data and try to use them to find nearest neighbors with fluid.dataset.

I compare the fluid.mfcc with the results I get from Carmine Cella’s mfccs (latest available distribution of orchidea) and I must say, his lead to better results (I’m using both with comparable FFT settings and 20 components).
In order to explain what I observe, I made a 5 minute video, I’m also going the share with Carmine.

https://vimeo.com/user65354774/review/418616716/70a0c3d423

With flucoma, I’m using median average over the entire sound. I compare it with Carmines averaged mfcc 20. I also compare it to my division of the sound into a few chunks (right now actually 6, compared to the 4 from a few days ago)
You will see that method in the video on the upper right.

But after a lot of testing I find that Carmine’s ‘static’ mfcc, which does somehow take the energy into account, leads to even better searches of neighbors, than splitting the sound into chunks.

As I’m not sure if FloComa is actively talking to Carmine, I just send this ‘observation’ to both of you and look forward to any thoughts, input etc.

Best, Hans

1 Like

That’s interesting. Quite stark difference there.

I guess MFCC implementation can vary a lot (much like how Pitch, as a metric, can have loads of ways of arriving to it).

Curious to hear the responses.

Wow, it does sound nearer in the sustain part indeed, but there is a few unknown in both implementations, yours and theirs. I’m sure @weefuzzy and @groma will chime in too. But the ‘flucoma mfcc’ is just a little part of the process you are using here, as you can see:

  1. what are you doing in the processing of the time series of MFCCs - averaging, mean, std, min, max, median, derivatives, etc. The ‘best’ result you get from flucoma is when you actually shrink time in 4 slots, which would be uneven because you divid in 4. what is happening in the other 4 cases is not clear from the video explanation.
  2. have you tried normalisation and standardisation with the flucoma tools? that will give you different results for sure… above the stats I just talked about just here.
  3. what proximity metrics do they use? I wonder how they find the nearest, it might be a different way and your patch is quite closed so I cannot see what database/query you are using…
  4. which mfcc implementation they use? Are they also normalising/standardising the data?

Things that I like about this experiment the most is the diversity of results. Each of the 5 methods give you consistent results, each in their own space. Considering all the questions above, I find fascinating all the experiments you can do, but also how all these digital debris are useful compositionally.

Let us know what you find out. Questions #1 and #2 are definitely possible to explore with what you have in hands, and as I said before, the time and scale manipulations are far from trivial and will give you very different results. If reverse engineering of a blackbox is a motivation for you, as it was for @rodrigo.constanzo and his drum analysis, this is great! If you find answers to questions #3 and #4 that might give us interesting insights as this might be trivial to implement, or already there…

Also, he could join here to discuss if he wants. This is a cooperative community of like-minded creative coders trying to get questions he has at his heart, so that should be fun!

Hans. I covet your 12 channel home studio.

Is there any chance that breaking the file up the way FluCoMa does is introducing an amplitude onset artifact in the data? Far fetched idea, but that is what it “sounds” like.

1 Like

Here is the next step in my mfcc comparison.
In order to better understand which descriptors to use to build datasets, I’m comparing the fluid mfcc (20 components) with the orchidea mfcc, equally with 20 components.

Here is a video which runs you through the patch.

You need bach and dada, as well as the orchidea distribution from February 2020.
bach and dada are accessible through the package manager.
Orchidea: http://www.orch-idea.org

This is a zipped bach project.

Hope you get it to work.

Thanks, Hans

1 Like

mfcc-comparison-project.zip (81.1 KB)

and this is a link to the small Pianoteq sound set

Thanks @tutschku I’ll get myself set up with Orchidea and have a look at what’s going on, probably as a first step seeing if the distribution of our MFCCs is noticeably different to theirs and, if so, seeing if I can figure out why…

What would be good @tutschku is to see if Camine would tell you if they still use ircam descriptors under the hood. That would simplify our life since I would just do that… I know they used to but maybe not anymore…

I’m asking because i downloaded the command line tools, and the ‘feature’ program says it outputs ‘spectral centroid, spread, skewness and kurtosis’

ok here is the bit of code I needed - it extracts MFCCs and prints them to the console. @weefuzzy will enjoy that. It needs Bach and one orchidea external (which I pinched from the package)


----------begin_max5_patcher----------
3998.3oc6ct0iiZjE.94d9Uf7SIq5om5NvlWlruj8kHsRqztZUR1QX6pcyrX
vBimKIJyu8st.z1zfArgp6j4DoziaaCUcN024JP0+1qtYwxrOI2uv6u58Sd2
byu8patw7V523lxe+lEai9zpjn8lu1hkGJJxRWbq8ihWadyrku+0D+p2L8v1
3zDYg4.vku49hOmHMe4i9ZYGJZ981EUr5g3zMuKWtpvNwvbxcna8nh.8+PXU
+z6WJOF6oo3y6j1CXwxnzMK79E8m96u5U5eb6.EuT4GUBS0TrP9IybXwt73z
h1DZxUIzntEZA4N9sdbZnQzsxLQKyWfPsUteezF4Sjp27uxRNn9v2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1
WrbsM5ShkYeZFeJtZrjnDmyl8fIx8iOqfk4oMsBr8wkeXDk9og1Fb33.nkAA
m1oU0VAzDuVLAOCaUaOgO8Um4YXyOHPo4ts0W8B5gX6bKemZcLrUwxc1ggRW
1sPpZaclRlogSJYo+FO5M9E2Cp4v1Mlu5sbmNBkO861NuL2bounMootJ23Ey
1J2ksUk7jDOur81jvQaB95+naDNCaGObNXhCl3u3LwGrssUQ72RNHOu0casn
YL6JSW4D7GxkxzQOCGZOOuxI2+Qljj8wQO6BHbruMqRrs8GHdHuoOqFq7D8W
BgBlJAvrAx8CYIqG8z2udC2lWtugp6ZyQNeljIXV96iR8rG3bF7IzODa2XYD
TjHvxxXx7D4g5yr0ggn7.6NcNhJXrAzjnPM0XlcXNtri4Btn4l79yzeSS5dK
OuYnqAuwh3h5jFLMZ63dOUiz1t4xsG8ioy3X2g7cWncge81bKCq+anysGcsG
NiYBEwJ2P9IbjHz1Lw.tfDLkxUtbkL9Cx8i0gZMI8nLg55uHAW9jy1VOsOyQ
zJsd8V1lihd25SmDAZuLc89WZQVKh1WHu+PRR4FJ7v0zmaGTsSMcX8EHRT62
S2Ae+f4PnFsLQTtFs+YthVqyojPZXv0HSO6cu8i80ZbcxOUe6exaw2matrGU
S7osyt8DnmT2TWRstgTFvRaTeRBa2GspZxblD4tDsn5X98W8+ALrx1zB
-----------end_max5_patcher-----------

So @tutschku now I can confirm there are many unknowns just from the outset, as I was pointing in the first message. The most important one is that:

  • for fluid.bufmfcc you get a time series of MFCCs that you then need to decide how you process them statistically for the whole sound and then can normalise/standardize yourself. all that is left to you to decide and experiment with.
  • in orchidea.db.gen each file gets one value, one window, which mean that someone somewhere has decided on how to deal with the time series… and that can happen before and after normalisation of the data itself.

Since they do get amazing results indeed, we would either need to:

  • spend a lot of time trying to reverse engineer 2 unknowns…
  • get the information from the orchidea team on what they did.

I know @danieleghisi worked on this project, so he may have some interesting insights…

Another question for @danieleghisi - I wonder how the distances are measured in the dada query of the nearest ones…

edit - I saw @tutschku actually uses fluid.kdtree so that bit I know :slight_smile:

I asked those questions to Carmine a while ago. The only detail he gave in an email:

There are several ways to compute the MFCC that depends on which version of the dct you use. I DCT-II and, as told you, I perform an energy based weighted average of the coefficients.
PS: my computation is compatible with Dan Ellis’ version and I checked this with him several years ago.

He takes thus the amplitudes into account, but I don’t know how.

I would suggest that you reach out to him directly as those details (Dan Ellis’ implementation etc.) are outside of my expertise.

I understand that part. For now I’m just comparing his blackboxes results with a median average over the fluid.mfcc

Indeed but that is a shot in the dark, as what he does inside that blackbox is definitely where the difference is - and might have very little to do with MFCCs computation… hence my questions. Do you know if he is doing median or which other time-series statistical analysis they do?

I think what @tutschku quoted from Carmine gives us something to go on

  • They use DCT II. I can’t remember offhand which one we use, but IIRC we followed Essentia. Sounds like they followed librosa if they’re talking about Dan Ellis (or at least its default: librosa provides different options
  • I can sort of guess what an energy weighted average is, and I think it tells us pretty much how they’re getting their summary statistic.

IOW, I think we’ve got something we can test empirically in all that (and I’d be very surprised if they weren’t normalizing the coefficients at some point, but it should be pretty easy to determine).

2 Likes

another thing we don’t know from their blackbox is now many melbands they use at first… so many variables!

We can use librosa’s defaults as a starting hypothesis. @tutschku has already opened a dialogue between Carmine and I, so if we get stuck I can trouble him for further details.