javascriptaudiowavweb-audio-apicue-points

Getting audio markers / cue points with the Web Audio API


If I have an audio file in WAV format containing markers (or "cue points"), is there a way to get an array of those markers, preferably using the Web Audio API?

I seem to remember seeing a method to do so before, but I can't seem to find it.

Any help or suggestions would be great!


Solution

  • Today I stumbled across a repository which supports the retrieval of cue markers, along with a ton of other useful functionality. It works perfectly for what I was trying to do:

    var request = new XMLHttpRequest();
    request.open("GET", "file.wav", true);
    request.responseType = "arraybuffer";
    request.onreadystatechange = function() {
        if (this.readyState === 4 && this.status === 200) {
            var wave = new WaveFile(new Uint8Array(this.response));
            console.log(wave.listCuePoints()); // Works perfectly
        }
    };
    request.send();
    

    It works on the browser as well as on Node.js, which is fantastic!