In this recipe, we will use the Google Cloud Text-to-Speech API to convert a string into an audio file. We will use a client to send requests to a Google server for processing. We will use the audio file as input to the Converting speech to text Using the Google Cloud Speech-to-Text API recipe.
Converting text to speech using the Google Cloud Text-to-Speech API
Getting ready
To prepare, we need to follow these steps:
- Create a new Java Maven project
- Add the following dependencies to the POM:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-texttospeech</artifactId>
<version>0.70.0-beta</version>
</dependency>
<dependency>
<groupId...