opusscript icon indicating copy to clipboard operation
opusscript copied to clipboard

RangeError: offset is out of bounds

Open LeGeek01 opened this issue 4 years ago • 6 comments

Hello, I have an error when my bot play a song in a voice channel.

RangeError: offset is out of bounds
at Uint8Array.set ()
at OpusScript.decode (/home/LeGeek01/SecretHeberg-Musique/node_modules/opusscript/index.js:78:17)
at Decoder._decode (/home/LeGeek01/SecretHeberg-Musique/node_modules/prism-media/src/opus/Opus.js:64:25)
at Decoder._transform (/home/LeGeek01/SecretHeberg-Musique/node_modules/prism-media/src/opus/Opus.js:204:22)
at Decoder.Transform._write (node:internal/streams/transform:184:23)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at Decoder.Writable.write (node:internal/streams/writable:334:10)
at PassThrough.ondata (node:internal/streams/readable:749:22)
at PassThrough.emit (node:events:394:28)

I have :

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Thanks in advance for answers.

LeGeek01 avatar Aug 14 '21 15:08 LeGeek01

Same Problem

Gamer08YT avatar Jul 28 '22 18:07 Gamer08YT

I fix that by deleting the "type" or "mode" option, I don't remember because it was a year ago... I know this variable was equal to "opus"

LeGeek01 avatar Jul 28 '22 19:07 LeGeek01

Can u provide the code ?

fox3000foxy avatar Mar 23 '23 15:03 fox3000foxy

The code that fix this issue

fox3000foxy avatar Mar 23 '23 15:03 fox3000foxy

any fix on this yet

seyicoded avatar Oct 19 '23 18:10 seyicoded

Modify MAX_FRAME_SIZE = 48000 * 60 / 1000 to MAX_FRAME_SIZE = 960 * 6 in index.js, supports up to 120ms per frame

https://github.com/abalabahaha/opusscript/blob/07ae74db7385d6d1be981d929f2f2f2b7e6b8449/index.js#L21-L25

https://github.com/abalabahaha/opusscript/blob/07ae74db7385d6d1be981d929f2f2f2b7e6b8449/src/opusscript_encoder.cpp#L5-L9

xiangyuecn avatar Oct 31 '23 04:10 xiangyuecn