Skip to content
Chromaprint/AcoustID audio fingerprinting for the JVM
Branch: master
Clone or download
Latest commit 5b21fa9 May 24, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Fix coverage May 24, 2019
project Fix coverage May 24, 2019
scripts Store test results and artifacts May 13, 2019
src Chroma coverage May 24, 2019
.codecov.yml Add .codecov.yml May 24, 2019
.gitignore First commit May 6, 2019
Dockerfile Extract install and entrypoint scripts May 11, 2019
LICENSE First commit May 6, 2019 Update README May 24, 2019
build.sbt Fix codec dependencies May 23, 2019
scalastyle-config.xml First commit May 6, 2019


An implementation of the Chromaprint/AcoustID audio fingerprinting algorithm for the JVM, created originally in C++ by Lukáš Lalinský.

CircleCI codecov

What does it do?

It creates an audio fingerprint designed to identify near-identical audio tracks in the AcoustID and MusicBrainz databases. This can be used to identify unknown tracks, find duplicates and look up metadata.

How does it work?

The algorithm performs a pipeline of operations on an audio stream to extract its fingerprint:

  • The audio is resampled to mono at 11025Hz
  • It is split into a series of short frames
  • A Fast Fourier Transform is performed on each frame to extract components of different frequencies
  • Audio features such as notes are extracted from each frame
  • An image is created from the series of features
  • A fingerprint is extracted from the image as a long series of numbers
  • This raw fingerprint is compressed into a shorter string
  • The string can be compared with other fingerprints to obtain a similarity score

Installation and usage


The FFmpeg library must be installed, along with codecs for files to be analyzed, the libavcodec-extra package on Debian should provide all of these.


In your build.sbt, add:

resolvers += Resolver.bintrayRepo("mgdigital", "chromaprint")

libraryDependencies += "com.github.mgdigital" %% "chromaprint" % "0.2.2"

Then in your Scala application:

import chromaprint.quick._

val file = new"/audio/Pocket Calculator.flac")
val fingerprint = Fingerprinter(file).unsafeRunSync()

// AQADtNQYhYkYnGhw7X...

Note: The fingerprint is generated using a FS2 stream, and the Fingerprinter returns a type of IO[Fingerprint], which is a Fingerprint type wrapped in a Cats Effect IO type. Running ùnsafeRunSync() on the IO[Fingerprint] object is the quickest way to have it return the Fingerprint, a different IO method may be better suited to your application.

Build the Docker image

$ docker build -t chromaprint-scala .

Then run the command line app (assuming audio file in current folder, double quotes needed for filenames containing spaces).

$ docker run -ti -v $(pwd):/audio/ chromaprint-scala '"/audio/Pocket Calculator.flac"'

Identify track with AcoustID

Get an AcoustID client ID and provide the acoustid-client option in the command line app to lookup matches in the AcoustID database:

$ sbt run "/audio/Pocket Calculator.flac" --acoustid-client=MyClientId
[info] Running chromaprint.Main /audio/Pocket Calculator.flac --acoustid-client=MyClientId
Created fingerprint in 1.983s
Duration: 296.80008
Fingerprint (compressed): AQADtNQYhYkYnGhw7X....
AcoustID response received
c0c5a16f-64e0-4571-aa29-ba80e6cb7874: Result 1 with score 0.923195:
867cf1a1-c46a-4ad5-916f-0c5397ff65e5: 'Pocket Calculator' by 'Kraftwerk'

See the code for the command line app under chromaprint.cli for further examples.

Note that the fingerprinter requires an implicit for the FFT (Fast Fourier Transform) implementation. Adapters are provided for Breeze and through FFTW via JavaCPP Presets. I have seen intermittent errors in the FFTW adapter so would recommend using Breeze.


Performance was never going to be as good as the C++ library, which can calculate a fingerprint almost instantly - but it does need to be fast enough to be conveniently usable. On my hardware I can generate a first fingerprint in around 2.3 seconds from a standing start, with subsequent fingerprints generated in around 0.9 seconds (assuming audio files which need transcoding to PCM and resampling). Improving this further will be a target for future versions.

Copyright (c) 2019 Mike Gibson, Original Chromaprint algorithm Copyright (c) Lukáš Lalinský.

For Chris.

You can’t perform that action at this time.