AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > ! Speech and Voice Configuration >

AIU. - Artificial Intelligence Utility

AIU.SetTtsVoice

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.SetTtsVoice
Sets the voice for Text-to-Speech.

 

Intention

 

The AIU.SetTtsVoice command (aliased as AIU.Stsv) selects the voice to be used for audio generation by the AIU.TextToSpeech command. OpenAI provides a set of high-quality, pre-defined voices, each with a distinct personality. This command allows you to choose the one that best fits the tone and purpose of your application.

 

It’s like choosing the narrator for your robot—AIU.SetTtsVoice gives your application a distinct voice.

 

Illustration

 

┌────────────────────────┬────────────────────────┐

│ Script Command         │                        │

├────────────────────────┼────────────────────────┤

│ AIU.SetTtsVoice        │    nova                │

├────────────────────────┼────────────────────────┤

│ AI Engine              │ Result                 │

├────────────────────────┼────────────────────────┤

│ TTS Model              │ Voice is set to 'nova' │

└────────────────────────┴────────────────────────┘

      Selecting a voice for audio synthesis.

 

Syntax

 

AIU.SetTtsVoice|$$VOI

 

Parameter Explanation

 

P1 - $$VOI - (Variable, String, Required)

The name of the voice to use. The command is case-insensitive. Valid voice names are:
alloy (default)
echo
fable
onyx
nova
shimmer

 

Examples

 

'***********************************

' AIU.SetTtsVoice - Sample 1: Set a new voice for synthesis

'***********************************

VAR.$$KEY=sk-YourSecretKeyHere

AIU.SetKey|$$KEY

 

' Select a different voice

AIU.SetTtsVoice|nova

 

VAR.$$TXT=Hello from the nova voice!

VAR.$$PTH=?path\nova_voice.mp3

AIU.TextToSpeech|$$TXT|$$PTH

 

AIU.GetLastError|$$ERR

JNZ.$$ERR|Lab_failed

 

MBX.Success:|Audio file created at: $$PTH

END.

 

 

Remarks

 

- The selected voice is a global setting that persists for all subsequent AIU.TextToSpeech calls until it is changed again.

- If an invalid voice name is provided, the command will silently fall back to the default voice ("alloy").

- You can hear samples of the available voices on the official OpenAI Text-to-Speech documentation page.

 

See also:

 

AIU.TextToSpeech

AIU.GetTtsVoice

AIU.SetTtsModel