This demo app showcases how to use Google Cloud Text-to-Speech API on iOS. Google’s TTS API is very powerful and the available voices sound extremely fluent and natural. More details on the API can be found here. There's also a tutorial available here.
As with any Google Cloud API, the API has to be enabled on a project within the Google Cloud Console and all the API calls will be associated to that project. To setup a project in the Google Cloud Console, you can follow all the steps described here, except that this demo app requires an API key instead of a service account key.
- Create a project (or use an existing one) in the Cloud Console.
- Make sure that billing is enabled for your project.
- Enable the Text-to-Speech API.
- Create an API key.
- Clone this repo
$ git clone https://github.com/acotilla91/Google-TTS-Demo.git
- Open project in Xcode.
- Go to the
SpeechService
class and replace<YOUR_API_KEY>
with the actual API key that was obtained from the steps above. - Run the app. Should work on both, the device and simulator.
The WaveNet voices work perfectly, but the standard voices tend to fail. Might be a temporal bug on Google's side, since this is still a beta API.Issue seems resolved.
This project is available under the MIT license. See the LICENSE file for more info.