shazam-api
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Shazam Api for node-js

This library is heavily based on Numenorean's work.

Usage:

import { Shazam, s16LEToSamplesArray } from 'shazam-api';
import fs from 'fs';

const shazam = new Shazam();
const fileContents = fs.readFileSync("test.pcm");
const samples = s16LEToSamplesArray(fileContents);

const songData = await shazam.recognizeSong(samples);
console.log(songData);

The data passed to s16LEToSamplesArray needs to be raw PCM with:

  • Sample rate set to 16000Hz
  • Bit depth set to 16 bits
  • 1 channel of audio

Such a file can be generated with ffmpeg using the command:

ffmpeg -i <source file> -ar 16000 -ac 1 -f s16le test.pcm

Or within node or the browser thanks to ffmpeg.wasm

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    6
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    6
  • 0.1.3
    0
  • 0.1.2
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i shazam-api

Weekly Downloads

6

Version

0.2.0

License

GPL-2.0

Unpacked Size

85 kB

Total Files

17

Last publish

Collaborators

  • asivery