My javascript-webApp first reads a short mp3 file and finds silence-gaps in it (for navigational purposes), then it plays the same mp3 file cueing it to start where one silence or another finishes. This differs from the usual webAudio scenario designed to grant access to audio data currently being played in the stream (not to the whole track).
To get my webApp to work I have to read/access the mp3 file twice:
- via
XMLHttpRequest
to read an entire MP3 file and put it in to an audioBuffer that I can subsequently decode usingaudioContext.decodeAudioData()
- as explained here: Extracting audio data every t seconds - by specifying the
<audio>
tag to allow me to play the file on demand specifying in milliseconds the cue/start point. Playing audio with Javascript?.
Q: Is there currently any way I might declare the <audio>
tag first then somehow derive the audioBuffer directly from it, without resorting to XMLHttpRequest
?
I've read about createMediaElementSource
but I can't see how to get an audioBuffer
by using it.