On the SitePoint PHP blog today there's a new tutorial showing you how to combine the Microsoft Azure platform services with their Translator API to create a text-to-speech translation service with some simple curl calls.
Text to speech is a popular technique used by many websites to provide their content in an interactive way. The generation of artificial human voice is known as Speech Synthesis. Even though it's highly popular, there are very few speech synthesis services, especially when looking for those free of charge. Microsoft Translator is one of the services we can use to get a speech service with limited features. In this tutorial, we are going to look at how we can use Microsoft Translator API to translate content and then make audio files using said content.
He walks you through setting up an Azure application (you'll need an account for the marketplace already) and how to subscribe to the translation service. It's a paid service but there's a "try before you buy" level that allows 2,000,000 characters of translation before it's cut off - perfect for testing. He includes the PHP to make the requests to the Translation API via curl. Included is code to initialize the configuration for the request, get the correct tokens and a reusable method for making the actual translation request. Finally, an example of doing the actual text-to-speech conversion is shown, resulting in an mp3 file.
He also includes an example of a simple frontend UI. You can see a working demo of the script here.