Learn how to use PlayAI’s asynchronous Text-to-Speech API
This guide provides a step-by-step approach to using the PlayAI Text-to-Speech API to convert text into natural human-like sounding audio using the Async (non-streaming) API Endpoint.
In this example, we’ll have Dialog 1.0 create a simple audio from the given input text.
Set Up Environment Variables
Add your API key and user ID to your environment variables.
Configure API Access
Create a script with the following authentication setup for your chosen language:
Submit TTS Job
Create and submit your TTS job in your chosen language:
Poll Job Status
Monitor your job’s progress in your chosen language:
Download and Save Audio
Save the generated audio file in your chosen language:
If you encounter issues, check these common problems:
Authentication Issues:
AUTHORIZATION
header includes “Bearer ” prefixJob Status Polling:
API Endpoint Errors:
Language-Specific Issues:
node-fetch
is installed for Node.js environmentshttp
package is added to your pubspec.yaml