wo80 / AcoustID.NET

AcoustID fingerprinter and webservice access in .NET
39 stars 17 forks source link

Fingerprint differences compared with fpcalc.exe #10

Open powercode opened 2 months ago

powercode commented 2 months ago

I'm using the following code

        var fileName = @"C:\The Platters - The Great Pretender.mp3";
        var decoder = new NAudioDecoder(fileName);
        var ctx = new AcoustID.ChromaContext();
        ctx.Start(decoder.SampleRate, decoder.Channels);
        decoder.Decode(ctx, 120);
        ctx.Finish();
        var fingerPrint = ctx.GetFingerprint();

and compare the results to

fbcalc.exe -length 120 "C:\The Platters - The Great Pretender.mp3"

In both cases, the fingerprints are 3806 characters long and equal up to position 3200. After that, they differ.

Do you know if this is expected?

Both fingerprints can be used to resolve against the web service, and both have almost the same score (0.9830894 vs. 0.98312235), where the fbcalc.exe score is slightly more accurate.

Am I missing something here? Can I do anything to become more compatible with the fpcalc result?

wo80 commented 2 months ago

I don't think it's worth worrying about that. The first thing you could try is converting to wav format and 11025 Hz mono. Then compare the fingerprints of that wav file. That would rule out differences created by audio preprocessing.

But even then the fingerprints cannot be expected to be exactly the same. There's a lot of floating point arithmetic involved in the process and small differences might show up leading to different fingerprints in the end.

EDIT: additionally, I haven't compared my C# code to the original C++ code for a long time now, so the implementation details might have diverged a bit.