New AcoustID server release

I’ve just updated the AcoustID servers with the latest version of the code. There is a couple of changes on both the website and the API.

One important change on the website is addition of email and website fields to applications. If you are an author of an open source application that uses the AcoustID API, please fill them in so that I can contact you in case there is a problem with your API key. These fields are not displayed anywhere publicly.

Contributor statistics were also removed from the website. They were interesting when the project was small and had a couple of contributors, but recently I’ve had a increasing number of people asking to had their account removed from the statistics, so I’ve decided to remove the statistics completely.

The /v2/lookup method supports a new option sources in the meta parameter. It’s only applicable when meta includes also recordings and it tells the server to return also the number of sources for each returned recording (corresponding to the Sources field on the website).

There are also two new methods /v2/user/lookup?user=X and /v2/user/create_anonymous?client=X&clientversion=X, to support anonymous user accounts. They can be used from applications that can’t ask the users to log in on the Acoustid website, but there are a number of rules that such applications should follow:

  • The returned API keys must be stored in the user’s settings and re-used. Do NOT create a new API key every time the application is started.
  • You can’t assume the saved API key still exists. Unused anonymous accounts will get deleted after some time. Use the user lookup call to verify the API key still exists.
Posted in Acoustid, Announce | Tagged , , | Leave a comment

Acoustid fingerprinter 0.5.1 released

A new version of the Acoustid fingerprinter has been released. It’s contains just one small bug fix regarding compatibility with Qt 4.8. The official binaries for version 0.5 are not affected by this bug, so this is a source-only release.

Download:

Posted in Acoustid, Announce | Tagged , , | Leave a comment

Acoustid fingerprinter 0.5 released

A new version of the Acoustid fingerprinter has been released. The version adds support for Unicode file names on Windows, reading 24-bit audio file formats and can parse MBID tags from MP3 files written by foo_musicbrainz.

Download:

Changes since version 0.4:

  • Unicode filename support on Windows.
  • Support for 24-bit sample formats.
  • Reading MBID tags from foobar2000-written MP3 files.
  • Added .desktop file for Linux.
Posted in Acoustid, Announce | Tagged , , | 1 Comment

Chromaprint 0.6 released

A new version of Chromaprint has been released. As with the previous version, the core library hasn’t changed much. The fpcalc utility now supports 24-bit sample formats and by default calculates fingerprints using the first 2 minutes of audio. The Python bindings previously included in Chromaprint have been moved to a separate library, pyacoustid.

Download:

Changes since version 0.5:

  • Support for 24-bit file formats in fpcalc.
  • The fpcalc utility now uses 120 seconds of audio data by default.
  • Python bindings moved to a separate project (pyacoustid).
Posted in Acoustid, Announce | Tagged , , | 1 Comment

Inside the Acoustid server

Time flies really fast. It’s been over a year ago since I first released the server code for Acoustid. Back then, Acoustid was just an experiment, but the project is becoming more and more visible and these days it’s serving between 500k and 600k lookups every day.

What makes me more happy than that the project is being useful is that the decisions I’ve made regarding the server architecture turned out to work very well and the server generally very fast and scalable. The average lookup processing time is around 60ms and I expect the number to go down, not up in the future.

As the post about Chromaprint says, the audio fingerprints used in Acoustid are basically vectors of numbers. For performance reasons on the client side, applications are now calculating these fingerprints only from the first two minutes of audio files. That means that when the server scores the results, it only considers the first two minutes of audio. If two tracks have the same intro that is over two minutes long and then they get different, Acoustid will unfortunately see them as the same. This doesn’t cause too many practical problems though. The MusicDNS service that MusicBrainz currently supports also use only the first two minutes.

Before scoring the results, the server must somehow get the results in the first place, and this is where normally things get slow. The database currently has more than 10M fingerprints. If we assume all fingerprints have at least two minutes (which means 948 numbers per fingerprint), that’s 9480M numbers to search in. Just saving these numbers on disk, together with the pointers to the fingerprints they come from, would require 76GB of space. And since the search must be fast, the data must fit in RAM. This is obviously not the way to go if we want to be able to host the service on a single server and yet get response times below 100ms. The search space must be reduced.

Because Acoustid is meant to be used for file identification, I don’t necessarily need to search anywhere in the fingerprint. I know that the fingerprints I get are from the start of the song, I know that if the two fingerprints are similar enough, they must match across the whole length and I can assume that they also must match a specific (smaller) part. So even though the original fingerprints are two minutes long, I decided to search only in the part between 0:10 and 0:25.

The sub-fingerprints that cover these 15 seconds are stored in the Acoustid index database. Whenever I search for a fingerprint, I extract the 15 seconds long sub-fingerprint (“query”) and send it to the index server. The server returns a list of matching fingerprint IDs (“candidates”). These candidates represents fingerprints that might match the original fingerprint, but to not necessarily have to, because all I know about them is that they matched the extracted 15 seconds long query.

The next step is to take these candidates and compare them against the original fingerprint. This is done in PostgreSQL, where the full fingerprints are stored. Each of the candidates is compared against the original fingerprint using a function that tries to align the two fingerprints and then calculates the bit-error-rate between the overlapping parts. The result of this function is a score between 0 and 1. Fingerprints with the score above a certain threshold are considered valid matches, MusicBrainz metadata is looked up for them, they are returned to the user and that’s the end of it.

The whole process looks something like this:

This covers the searching side of the server. I’ll try to write another post soon about the data management side (importing, merging, etc).

Posted in Acoustid | Tagged , | 4 Comments