OneMusicAPI supports fingerprint based queries for both release and CD information. But how do you generate a fingerprint to send to the service? One option is to use fpcalc, part of the Chromaprint project.

OneMusicAPI's fingerprint queries utilise Chromaprint, the library for generating acoustic fingerprints written as part of the Acoustid project.

When you send an acoustic fingerprint query to OneMusicAPI, you must specify both the fingerprint itself and the track in question's duration (in seconds). Chromaprint includes both a C API and Python bindings, so users of those languages can easily get set up. However, if you use a different language your choice is less straightforward.

Many languages provide a way to consume a C library; for example Java has JNA and JNI, so that's one option. The other option is to invoke a command line app, fpcalc, and read the output from that.

Invoking fpcalc

The basic usage of fpcalc is as follows:

fpcalc 02-Skinny_Love.flac

Simple enough; just pass it the music file you want to generate the fingeprint for. In return we receive:

FILE=02-Skinny_Love.flac
DURATION=203
FINGERPRINT=AQADtEuSLGGSJAyxaR6qE8ln5DwutMkeoWkT[...]

The fingerprint is heavily truncated there! The fingeprint and duration can then be used when querying OneMusicAPI:

http://api.onemusicapi.com/20150623/release/maxResultCount=10&minCertainty=0.5&track.2.duration=203&track.2.fingerprint=AQADtEuSLGGSJAyxaR6qE8ln5DwutMkeoWkT...

Which gives us:

[
    {
        "title": "Birdy",
        "artist": "Birdy",
        "year": "2012",
        "genre": "pop",
        "media": [
            {
                "totalDiscs": "1",
                "position": "1",
                "tracks": [
                    {
                        "title": "1901",
                        "number": "1",
                        "artist": "Birdy"
                    },
                    {
                        "title": "Without a Word",
                        "number": "10",
                        "artist": "Birdy"
                    },
                    {
                        "title": "Terrible Love",
                        "number": "11",
                        "artist": "Birdy"
                    },
                    {
                        "title": "Just a Game",
                        "number": "12",
                        "artist": "Birdy"
                    },
                    {
                        "title": "What You Want",
                        "number": "13",
                        "artist": "Birdy"
                    },
                    {
                        "title": "Skinny Love",
                        "number": "2",
                        "artist": "Birdy"
                    },
                    {
                        "title": "People Help the People",
                        "number": "3",
                        "artist": "Birdy"
                    },
                    {
                        "title": "White Winter Hymnal",
                        "number": "4",
                        "artist": "Birdy"
                    },
                    {
                        "title": "The District Sleeps Alone Tonight",
                        "number": "5",
                        "artist": "Birdy"
                    },
                    {
                        "title": "I'll Never Forget You",
                        "number": "6",
                        "artist": "Birdy"
                    },
                    {
                        "title": "Young Blood",
                        "number": "7",
                        "artist": "Birdy"
                    },
                    {
                        "title": "Shelter",
                        "number": "8",
                        "artist": "Birdy"
                    },
                    {
                        "title": "Fire and Rain",
                        "number": "9",
                        "artist": "Birdy"
                    }
                ]
            }
        ],
        "score": 1
    }
Thanks to photosteve101 who made the the image above available for sharing.
comments powered by Disqus
© 2017 elsten software limited, Unit 4934, PO Box 6945, London, W1A 6US, UK | terms and conditions | privacy policy