https://github.com/asivery/node-shazam-api
Fully reverse engeenired shazam api based on Numenorean's ShazamAPI
https://github.com/asivery/node-shazam-api
Last synced: about 1 year ago
JSON representation
Fully reverse engeenired shazam api based on Numenorean's ShazamAPI
- Host: GitHub
- URL: https://github.com/asivery/node-shazam-api
- Owner: asivery
- License: gpl-2.0
- Created: 2022-09-28T15:52:23.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-09T02:26:30.000Z (over 1 year ago)
- Last Synced: 2025-03-20T15:12:31.128Z (about 1 year ago)
- Language: TypeScript
- Size: 121 KB
- Stars: 18
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
## Shazam Api for node-js
This library is heavily based on [Numenorean's work](https://github.com/Numenorean/ShazamAPI).
Usage:
```js
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 -ar 16000 -ac 1 -f s16le test.pcm
```
Or within node or the browser thanks to [ffmpeg.wasm](https://www.npmjs.com/package/@ffmpeg/ffmpeg)