Gimme-the-song is a simple lib that recognize a music from a audio file. Its a Javascript implementation of AcoustId Chromaprint and their service. As it depends on a C library, Gimme-the-song needs to run on server side.
npm install gimme-the-song
The "gimme" method receive an audio file, generates an audio fingerprint and search on MusicBrainz database using AcoustId Service.
const {gimme, setGimmeKey} = require('gimme-the-song')
const path = require('path')
// Remember to set a valid client key. Otherwise gimme will return null.
// If you don't have a client key, access https://acoustid.org/new-application to register your application and get a client key.
setGimmeKey('YOUR API KEY')
// get the full path to the file
const file_path = path.join(__dirname, './sample.mp3')
// call 'gimme' method, receive the results and console it
gimme(file_path, {}, (results) => {
console.log(results)
})
If you just want to get the audio fingerprint, use the method "fpcalc". Similar to "gimme", it receives an audio file and generates an audio fingerprint. There is no need to set a cliente key if you are using just this method.
const {fpcalc} = require('gimme-the-song')
// get the full path to the file
const file_path = path.join(__dirname, './sample.mp3')
// call the method 'fpcalc', receive the results and console it
fpcalc(file_path, (results) => {
console.log(results.fingerprint, results.duration)
})
I didn't needed to program the audio fingerprint proccess, I just did an implementation for Javascript. So, huge thanks and credits to Lukáš Lalinský and congratulations to his awesome project AcoustID and also to the guys from MusicBrainz who are storing all the fingerprinties. These were the only free open sources projects I found looking for hours on the internet. Thanks for the initiative!