-
Hi, I would like to load the buffer in AudioContext in memory, instead of reading from a URL. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Edit: this answer is not fully correct, you cannot directly convert an audio buffer to a blob, see https://stackoverflow.com/a/62173861 You can load a decoded buffer like this in v7: const url = URL.createObjectURL(new Blob([audioBuffer], { type: 'audio/wav' }))
const peaks = [ audioBuffer.getChannelData(0), audioBuffer.getChannelData(1) ]
const duration = audioBuffer.duration
wavesurfer.load(url, peaks, duration) Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
I get this compilation error: Use case: I'm trying to clone a wavesurfer instance with the following code:
In v6, this worked:
What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Edit: this answer is not fully correct, you cannot directly convert an audio buffer to a blob, see https://stackoverflow.com/a/62173861
You can load a decoded buffer like this in v7:
Hope this helps.