Howler.js: Play an audio buffer like AudioStream in AWS API

Created on 11 Jan 2017  路  2Comments  路  Source: goldfire/howler.js

Hi, I am newbee in Howler. Can Howler play a buffer like AudioStream in AWS API.

const polly = new AWS.Polly();

polly.synthesizeSpeech({
  OutputFormat: 'mp3',
  Text: 'hello Polly.',
  VoiceId: 'Joanna'
  },
  function (err, data) {
    if (err) {
      console.log(err, err.stack); 
    } else {
      // Now I hope to play the data.AudioStream with howler but I can out find some related API.
      // The audioStream is a piece of MP3 which can be saved into file system as mp3 file.
      fs.writeFile("hello.mp3", data.AudioStream, function(err) {
          if(err) {
              return console.log(err);
          }
          console.log("The mp3 file was saved!");
      }); 
    }
  }
);

Most helpful comment

howler will accept a data: URI structure, If the audioStream can be converted to a arrayBuffer, there is code available to Base64 encode it, then you could do something like

howlSource = ["data:audio/mp3;base64,"+base64ArrayBuffer(arrayBuffer)];

soundPlayerObj = new Howl({
        src: howlSource,
});

See here:
https://loops.planeptune.org/stuff/loopplayer.html5.core.js

and CTRL-F for base64ArrayBuffer

All 2 comments

howler will accept a data: URI structure, If the audioStream can be converted to a arrayBuffer, there is code available to Base64 encode it, then you could do something like

howlSource = ["data:audio/mp3;base64,"+base64ArrayBuffer(arrayBuffer)];

soundPlayerObj = new Howl({
        src: howlSource,
});

See here:
https://loops.planeptune.org/stuff/loopplayer.html5.core.js

and CTRL-F for base64ArrayBuffer

@zefie Thank you very much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

proyb6 picture proyb6  路  4Comments

tvbird picture tvbird  路  4Comments

kamkha picture kamkha  路  3Comments

lili21 picture lili21  路  4Comments

Friksel picture Friksel  路  4Comments