Text To Speech
ActionStep Reference » OpenAI » Audio » Text To Speech
The OpenAI Text To Speech ActionStep is a function that converts written text into spoken words, creating an audio file. This ActionStep integrates with OpenAI's API to utilize advanced text-to-speech technology.
- Open the OpenAI node in the Workspace Explorer.
- In the Audio node, select the Text To Speech ActionStep.
Parameters:
The ActionStep has the following input parameters:
Name |
Description
|
---|---|
API Key | The OpenAI API key. Allowed Context Scopes [Fixed, Local, Global, Reference] Allowed Context Types [Fixed, Variable, Parameter, Result, Enum] Allowed Context Values [String] |
Text | The text to be converted into an audio file. Allowed Context Scopes [Fixed, Local, Global, Reference] Allowed Context Types [Fixed, Variable, Parameter, Result, Enum] Allowed Context Values [String] |
Destination Path | The destination folder path of the generated audio. Allowed Context Scopes [Fixed, Local, Global, Reference] Allowed Context Types [Fixed, Variable, Parameter, Result, Enum] Allowed Context Values [String] |
Voice | The voice to use in audio generation. Allowed Context Scopes [Fixed, Local, Global, Reference] Allowed Context Types [Fixed, Variable, Parameter, Result, Enum] Allowed Context Values [String] |
Timeout | The duration in ms before the API request times out. Allowed Context Scopes [Fixed, Local, Global, Reference] Allowed Context Types [Fixed, Variable, Parameter, Result, Enum] Allowed Context Values [Int64] |
Results:
The ActionStep returns the following results:
name |
Description
|
---|---|
Success | Indicates whether the result is successful. Allowed Context Scopes [Fixed, Local, Global, Reference] Allowed Context Types [Fixed, Variable, Parameter, Result, Enum] Allowed Context Values [Boolean] |
Audio File Path | The path of the generated audio file. Allowed Context Scopes [Fixed, Local, Global, Reference] Allowed Context Types [Fixed, Variable, Parameter, Result, Enum] Allowed Context Values [String] |
Example 1 (Text to Speech Conversion):
This example demonstrates an ActionScript sequence that uses OpenAI's Chat service to generate text, which is then converted into speech. The script starts with the OpenAI Chat ActionStep that poses a question about the ease of use of MycroTools XenoGuard, expecting a text response. Next, the OpenAI Text To Speech ActionStep is used to convert the received text into an audio file, selecting "ALLOY" as the voice for the speech output. This process saves the resulting audio file to a predefined destination path. Finally, the script plays the audio file from the generated path, allowing the user to listen to the spoken version of the chat response. The sequence is efficient, chaining the chat response directly into the text-to-speech conversion, showcasing an end-to-end automated communication flow.
See other operations:
Transcribe Audio
Translate Audio To English