RangeError new ArrayBuffer Array buffer allocation failed #3905
Unanswered
kumarajay0412
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Looks like a bug in your app. Please don’t file it as a wavesurfer bug. From the snippet shown I can’t tell what the problem is. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Copilot says: To address the off-by-N error in the buffer slicing code, you can adjust the slicing and setting logic for
Here is a potential fix for your code: const drawWaveform = () => {
if (this.isWaveformPaused) return;
analyser.getFloatTimeDomainData(dataArray);
if (this.options.scrollingWaveform) {
const windowSize = Math.floor((this.options.scrollingWaveformWindow || 0) * audioContext.sampleRate);
const newLength = Math.min(windowSize, this.dataWindow ? this.dataWindow.length + bufferLength : bufferLength);
const tempArray = new Float32Array(windowSize); // Always make it the size of the window, filling with zeros by default
if (this.dataWindow) {
const startIdx = Math.max(0, windowSize - this.dataWindow.length);
const sliceLength = Math.min(this.dataWindow.length, newLength - bufferLength);
tempArray.set(this.dataWindow.slice(-sliceLength), startIdx);
}
tempArray.set(dataArray, windowSize - bufferLength);
this.dataWindow = tempArray;
}
}; This adjustment ensures that the slice length is correctly calculated to fit within |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is the implementation of wavesurfer with RecordPlugin getting error a lot of time Array buffer allocation failed and i am not able to resolve this can anyone help me here
Beta Was this translation helpful? Give feedback.
All reactions