Text-to-Speech
Convert any text to natural-sounding audio using AI providers. aiSpeak() returns binary audio data wrapped in an AiSpeechResponse with helpers for saving, encoding, and streaming.
🔧 The aiSpeak() Function
aiSpeak() FunctionSyntax
aiSpeak( text, params={}, options={} )Parameters
Parameter
Type
Required
Description
Options
Option
Type
Default
Description
📦 Return Value — AiSpeechResponse
AiSpeechResponseAiSpeechResponse Methods
AiSpeechResponse MethodsMethod
Returns
Description
💡 Examples
Basic — synthesize and save to file
Shorthand with outputFile option
outputFile optionCustom provider and voice
🧱 Fluent Builder API (v3.2.0+)
Basic Builder Usage
Builder Methods
Method
Description
Fluent Examples
Gender keyword voices
Base64 / data URI for web responses
ElevenLabs — high-quality multilingual voice
Generate comparison files across all voices
🎙️ Provider Voice Reference
Customising the gender map
📡 Events
Event
Data Available
📖 Related Pages
Last updated