Load audiodata into AudioBufferSourceNode from <audio/> element via createMediaElementSource?

前端 未结 3 930
攒了一身酷
攒了一身酷 2021-01-04 06:23

Is it possible to have an audiofile loaded from -element via createMediaElementSource and then load the audio data into a Aud

3条回答
  •  醉酒成梦
    2021-01-04 06:37

    I'm not sure if you found a better solution yet and I also checked the W3C link you posted: http://www.w3.org/2011/audio/wiki/Spec_Differences#Reading_Data_from_a_Media_Element

    But in order for it to really work you have to use AudioContext.createScriptProcessor(). I didn't yet tried this but basically you connect the source node (an audio element) to a script processor but then don't even output the audio if you don't need it. In the onaudioprocess callback you have direct access to the audio buffer data (in chunks of a specified size of course). There are examples in the link above.

    Also I think you can somehow tweak the speed of the playback so that you can get more buffer arrays faster.

提交回复
热议问题