How to dub audio and generate synthetic voices using Google text to speech
How to dub audio and generate synthetic voices using Google text to speech
You can now simply dub your audio/video in a synthetic voice using Google text to speech and AVflow. When you combine this with the transcription and translation steps, you will be able to dub your video in dozens of foreign languages super fast and with a setup that only takes a few minutes.
Here's how to setup Google TTS using a webhook trigger that accepts the text passed in the body of API request from your system, then converts it to audio using Google TTS step. Then a webhook is sent back to your system for further processing or rendering.
1. Create a Flow and add the webhook step (more info on using webhooks); then add the Google TTS step to the Flow
2. Select "Text to speech" as the action
3. Setup TTS service options
Language code: the code associated with the source texts language (refer here for code)
Speaking Rates: An array of a valid numbers from 0 to 4 specifies the speaking speed for each text. This step is optional and if no value is set, the default is 0.
Voices: An array of accepted voices (optional, refer to the column "Voice name" here for valid values)
Gender (optional): An array to choose the gender of the synthetic voice. A valid value is MALE or FEMALE
Google TTS Credential: Google TTS key that can be retrieved during enabling service in Google Console.
async function main (service, context) { for (let i = 0; i < service.files.length; i++) { let source_file = `./text-to-speech-service/${service.files[i]}`; let dest_file = `${service.files[i]}`;