Connect analyzer to Howler sound

前端 未结 2 704
夕颜
夕颜 2021-02-06 08:37

I have been trying for a while to connect an analyser to a Howler sound without any success.

I create my Howler sound like this:

var sound = new Howl({
          


        
2条回答
  •  南旧
    南旧 (楼主)
    2021-02-06 09:17

    You need to connect the node that outputs the audio you want to analyse to the analyser node, and then connect the analyser node to the context destination (or another node). So something like this:

    //this is a bufferSource with a decoded buffer that we want to analyse
    source.connect(analyser);
    analyser.connect(context.destination);
    

    Once you've done that you should be able to start requesting the result of the analysis as per https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode

提交回复
热议问题