title: How to play AudioStream response in AWS Polly using JavaScript SDK?
body: <p>This is my script:</p>
  
  <pre><code>&lt;script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.13.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      AWS.config.region = 'eu-west-1';
      AWS.config.accessKeyId = 'FOO';
      AWS.config.secretAccessKey = 'BAR';
  
      var polly = new AWS.Polly({apiVersion: '2016-06-10'});
  
      var params = {
          OutputFormat: 'mp3', /* required */
          Text: 'Hello world', /* required */
          VoiceId: 'Joanna', /* required */
          SampleRate: '22050',
          TextType: 'text'
      };
  
      polly.synthesizeSpeech(params, function(err, data) {
          if (err) console.log(err, err.stack); // an error occurred
          else     console.log(data);           // successful response
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>The request succeeds, and I get this kind of response:</p>
  
  <p><a href="https://i.stack.imgur.com/JQAxe.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JQAxe.png" alt="enter image description here"></a></p>
  
  <p><strong>How do I use this kind of response?</strong> I understand that the response is deserialized audio, but how do I actually play it, say, inside a HTML5 audio element?</p>
  
  <p>Furthermore, this answer on SO explains why is this type of array suitable for audio data: <a href="https://stackoverflow.com/a/26320913/1325575">https://stackoverflow.com/a/26320913/1325575</a></p>