1.3.0 • Published 7 months ago

ncm-audio-recognize v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

NeteaseCloudMusic-Audio-Recognize

Usage

$ npm install ncm-audio-recognize
$ node test.js samples/Komplexe.mp3
Module loading: /Users/natsuki/workspace/ncm-audio-recognize/afp.wasm
Module loaded: [object WebAssembly.Instance]
Encoded Data:  W5/Hd3yYCY2E....
[1] Komplexe - 雄之助 Album: 「maimai でらっくす ベストアルバムちほー」 CID: [1914659931]

Example Code

import ncmutils from 'ncm-audio-recognize'
import fs from 'fs'

const buffer = fs.readFileSync("./takenohana.mp3")
const encoded = await ncmutils.encode(buffer)
const result = await ncmutils.recognize(encoded)
console.log(`Matched result count: ${result.length}`)
result.forEach((item, index) => {
    console.log(`[${index + 1}] ${item.song.name} - ${item.song.artists.map(artist => artist.name).join('/')} Album: 「${item.song.album.name}」 CID: [${item.song.id}]`)
})

Documentation

encode(fileBuffer)

ParamsTypeDescription
fileBufferBufferThe audio file data.

Returns: string The encoded data.


recognize(encodedData)

ParamsTypeDescription
encodedDatastringThe encoded data.

Returns: Array The matched result.


rawEncode(audiodata, from, len, channel)

ParamsTypeDescription
audioContextDataAudioBufferThe audio data.
fromnumberThe time when the audio data started
lennumberThe secs of the audio data.
channelnumberThe channel of the audio data.

Returns: string The encoded data.

Credits

MicroCBer/BeatSaverSongData

1.3.0

7 months ago

1.2.0

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago