chrvadala / music-beat-detector

music-beat-detector is a library that analyzes a music stream and detects any beat. It can be used to control lights or any magic effect by the music wave.
MIT License
252 stars 25 forks source link

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 13203. Received 13204 #10

Open teh0 opened 3 years ago

teh0 commented 3 years ago

Hello,

I am coding a web application and i need your libs to retrieve beats of youtube audio music. I encountered a problem when i pipe buffer on express response. Peaks are detected until 16652ms and beyond this limit, an error is thrown :

`node:internal/process/promises:227 triggerUncaughtException(err, true / fromPromise /); ^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 13203. Received 13204 at new NodeError (node:internal/errors:278:15) at boundsError (node:internal/buffer:84:9) at Buffer.readInt16LE (node:internal/buffer:412:5) at MusicBeatDetector._analyzeBuffer (/Users/teho/Sites/poc/audio/server/node_modules/music-beat-detector/src/MusicBeatDetector.js:41:27) at DestroyableTransform._transform (/Users/teho/Sites/poc/audio/server/node_modules/music-beat-detector/src/MusicBeatDetector.js:31:7) at DestroyableTransform.Transform._read (/Users/teho/Sites/poc/audio/server/node_modules/readable-stream/lib/_stream_transform.js:177:10) at DestroyableTransform.Readable.read (/Users/teho/Sites/poc/audio/server/node_modules/readable-stream/lib/_stream_readable.js:456:10) at flow (/Users/teho/Sites/poc/audio/server/node_modules/readable-stream/lib/_stream_readable.js:939:34) at Speaker.pipeOnDrainFunctionResult (/Users/teho/Sites/poc/audio/server/node_modules/readable-stream/lib/_stream_readable.js:749:7) at Speaker.emit (node:events:376:20) { code: 'ERR_OUT_OF_RANGE' } [nodemon] app crashed - waiting for file changes before starting...`

My nodejs version is v15.5.1 I am a bit hard to understand the origin of the problem (I am a novice with Stream and Buffer) that is why I seek your assistance for this problem. I remain at your disposal if you need complementary informations !

chrvadala commented 3 years ago

Locks like a wrong sample read, can you provide some more info to reproduce it?