Skip to content

Where is loadDecodedBuffer in v7? #2806

Answered by katspaugh
tmtakashi asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@tmtakashi
Comment options

@Guillermogsjc
Comment options

Answer selected by tmtakashi
Comment options

You must be logged in to vote
1 reply
@katspaugh
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #2805 on May 30, 2023 09:03.