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!");
});
}
}
);
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.
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
See here:
https://loops.planeptune.org/stuff/loopplayer.html5.core.js
and CTRL-F for base64ArrayBuffer