Jump to content

add audio buffer to cache


raksa
 Share

Recommended Posts

hi i'm a newbie for phaser framework

i want to know that is it possible to load audio from existing buffer or blob data to cache?

for instant after i got audio buffer from input audio, i want to play it by phaser audio.

because there a problem in Android browser, i can't play audio from converted dataurl via html5 audio tag.

thanks,

Link to comment
Share on other sites

i got the answer:rolleyes:

var fileReader = new FileReader();
fileReader.onload = function () {
   game.cache.addSound("key", "filename.wav", this.result);
   //and use it
   var audio = game.add.audio("key");
   audio.play();
};
fileReader.readAsArrayBuffer(blob);

 

Link to comment
Share on other sites

  • 2 years later...

Hi... If you have to do complex operations to prepare the sound data, 23 ms may be not much. Additionally there may be some overhead to handle the DMA interrupt at the end of the transmission of each sound buffer and to manage the data cache, which is required to ensure, the sound data can be written out using DMA. Unfortunately I cannot specify, how much overhead this will take, without doing complex measurements, but I guess it will be not more than a few milliseconds.

printed circuit board

Edited by ClywdSlade
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...