azureazure-cognitive-servicesbing-speech

How do I playback the audio stream returned from Bing Text to Speech API?


I'm using the Azure code sample for Text to Speech API (https://github.com/Azure-Samples/Cognitive-Speech-TTS/tree/master/Samples-Http/PHP) which returns the audio but I don't understand how I capture the stream for playback in the browser?

I'm trying to build the Text to Speech demo here https://azure.microsoft.com/en-us/services/cognitive-services/speech/


Solution

  • Using file_put_contents takes the output from the API and streams the content to a file

    file_put_contents($speechfilenamemp,$result);