All Projects → mgdigital → Chromaprint.scala

mgdigital / Chromaprint.scala

Licence: other
Chromaprint/AcoustID audio fingerprinting for the JVM

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Chromaprint.scala

MixingBear
Package for automatic beat-mixing of music files in Python 🐻🎚
Stars: ✭ 73 (-9.88%)
Mutual labels:  audio-analysis, audio-processing
Q
C++ Library for Audio Digital Signal Processing
Stars: ✭ 481 (+493.83%)
Mutual labels:  music, audio-processing
tsunami
A simple but powerful audio editor
Stars: ✭ 41 (-49.38%)
Mutual labels:  audio-analysis, audio-processing
ACA-Slides
Slides and Code for "An Introduction to Audio Content Analysis," also taught at Georgia Tech as MUSI-6201. This introductory course on Music Information Retrieval is based on the text book "An Introduction to Audio Content Analysis", Wiley 2012/2022
Stars: ✭ 84 (+3.7%)
Mutual labels:  audio-analysis, audio-processing
Giada
Your Hardcore Loop Machine.
Stars: ✭ 903 (+1014.81%)
Mutual labels:  music, audio-processing
MusicVisualizer
A music visualizer based on the ATMEGA328P-AU
Stars: ✭ 30 (-62.96%)
Mutual labels:  audio-analysis, audio-processing
Inaspeechsegmenter
CNN-based audio segmentation toolkit. Allows to detect speech, music and speaker gender. Has been designed for large scale gender equality studies based on speech time per gender.
Stars: ✭ 352 (+334.57%)
Mutual labels:  music, audio-analysis
Awesome Deep Learning Music
List of articles related to deep learning applied to music
Stars: ✭ 2,195 (+2609.88%)
Mutual labels:  music, audio-processing
Audio Visualizer Android
🎵 [Android Library] A light-weight and easy-to-use Audio Visualizer for Android.
Stars: ✭ 581 (+617.28%)
Mutual labels:  music, audio-processing
Chromaprint
C library for generating audio fingerprints used by AcoustID
Stars: ✭ 553 (+582.72%)
Mutual labels:  audio-processing, audio-analysis
Gist
A C++ Library for Audio Analysis
Stars: ✭ 244 (+201.23%)
Mutual labels:  music, audio-analysis
Music Synthesis With Python
Music Synthesis with Python talk, originally given at PyGotham 2017.
Stars: ✭ 48 (-40.74%)
Mutual labels:  music, audio-analysis
Cloudtunes
Web-based music player for the cloud ☁️ 🎶 Play music from YouTube, Dropbox, etc.
Stars: ✭ 2,449 (+2923.46%)
Mutual labels:  music, musicbrainz
audio noise clustering
https://dodiku.github.io/audio_noise_clustering/results/ ==> An experiment with a variety of clustering (and clustering-like) techniques to reduce noise on an audio speech recording.
Stars: ✭ 24 (-70.37%)
Mutual labels:  audio-analysis, audio-processing
Otto
Sampler, Sequencer, Multi-engine synth and effects - in a box! [WIP]
Stars: ✭ 2,390 (+2850.62%)
Mutual labels:  music, audio-processing
Audio-Classification-using-CNN-MLP
Multi class audio classification using Deep Learning (MLP, CNN): The objective of this project is to build a multi class classifier to identify sound of a bee, cricket or noise.
Stars: ✭ 36 (-55.56%)
Mutual labels:  audio-analysis, audio-processing
Last Fm
Simple, robust LastFM API client (for public data)
Stars: ✭ 142 (+75.31%)
Mutual labels:  music, musicbrainz
Essentia
C++ library for audio and music analysis, description and synthesis, including Python bindings
Stars: ✭ 1,985 (+2350.62%)
Mutual labels:  music, audio-analysis
Tauonmusicbox
The Linux desktop music player from the future! 🌆
Stars: ✭ 494 (+509.88%)
Mutual labels:  music, musicbrainz
Strawberry
🍓 Strawberry Music Player
Stars: ✭ 972 (+1100%)
Mutual labels:  music, musicbrainz

Chromaprint.scala

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

Download 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

Requirements

This package is build for Scala 2.11 and 2.12. 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.

SBT

In your build.sbt, add:

resolvers += Resolver.jcenterRepo

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

Then in your Scala application:

import chromaprint.quick._

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

println(fingerprint.compressed)
// 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.

Java interop

In your pom.xml, add:

    <repositories>
        <repository>
            <id>jcenter</id>
            <name>jcenter</name>
            <url>https://jcenter.bintray.com/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.github.mgdigital</groupId>
            <artifactId>chromaprint_2.12</artifactId>
            <version>0.3.1</version>
        </dependency>
    </dependencies>

Then in your Java application:

import java.io.File;
import chromaprint.AudioSource;
import chromaprint.Fingerprint;
import chromaprint.quick.Fingerprinter;

File file = new File("/audio/Pocket Calculator.flac");
AudioSource source = new AudioSource.AudioFileSource(file);
Fingerprinter fingerprinter = new Fingerprinter();
Fingerprint fingerprint = fingerprinter.apply(source).unsafeRunSync();
System.out.println(fingerprint.compressed());
// AQADtNQYhYkYnGhw7X...

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
Fingerprinting...
Created fingerprint in 1.583s
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

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 laptop I can generate a first fingerprint in around 1.6 seconds from a standing start, with subsequent fingerprints generated in around 0.5 seconds (assuming audio files which need transcoding to PCM and resampling).


Copyright (c) 2019 Mike Gibson, https://github.com/mgdigital. Original Chromaprint algorithm Copyright (c) Lukáš Lalinský.


For Chris.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].