AI DevKit
Glitch9 Inc.Glitch9 DocsDiscordIssues
  • Introduction
    • AI DevKit 3.0
    • Update Logs
    • Troubleshooting
      • ❗Issues After Updating AIDevKit?
      • ❗The type or namespace name 'Newtonsoft' could not be found
      • ❗Build Error: The name 'UnityMenu' does not exist in the current context
      • ❗Model 'modelName' not found
      • ❗The model `model name` does not exist or you do not have access to it
      • ❗The type or namespace name 'AndroidJavaObject' could not be found
      • ❗The type or namaspace name 'Plastic' does not exist
      • ❗Build Error: The name 'Asset Database' does not exist in the current context
      • ❗'ModelData.Create(Provider, string, UnixTime?, string)': not all code paths return a value
      • ⚠️ Timeout Issues
      • ⚠️ Receiving a “HTTP/1.1 400 Bad Request” Error?
    • FAQ
      • My OpenAI API free trial has ended or is inactive.
  • Quick Start
    • Get API Keys
      • OpenAI API Key Guide
      • Google API Key Guide
      • ElevenLabs API Key Guide
    • Text Generation
    • C# Object Generation
    • Image Generation
    • Sound Effect Generation
    • Text to Speech (TTS)
    • Speech to Text (STT)
    • Voice Changer
    • Audio Isolation
  • Pro Features
    • Generation Menu
      • Code Generators
        • C# Script Generator
        • Unity Component Generator
    • Editor Chat
    • Editor Vision (TTI, ITI)
    • Editor Speech (TTS)
    • Management Tools
      • Prompt History Viewer
      • AI Model Manager
      • TTS Voice Manager
      • OpenAI File Manager
      • OpenAI Assistant Manager
      • ElevenLabs Voice Library
  • Assistants API (OpenAI)
    • How it works
    • Creating custom functions
    • Creating assistants API
  • Advanced API Supports
    • OpenAI API
      • 💬Chat completions
      • 🖼️Image operations
      • 🗣️Text to speech
      • 🎙️Speech to text
        • Recording real-time in Unity
      • 💾Files
      • 🔎Embeddings
      • 🛡️Moderations
      • ⚙️Fine-tuning
    • Google API
      • 📝System instructions
      • 💬Text generation
      • ⚙️Fine-tuning
      • ▶️Fucntion calling
      • 🔎Embeddings
      • 🛡️Safety
      • 💻Code execution
    • ElevenLabs API
  • Legacy Documents
    • AI DevKit 1.0 - 2.0
      • AI DevKit 2.0
      • AI DevKit 1.0
      • Preperation
      • Event Handlers
      • Scriptable Toolkits
        • Chat Streamer
        • Image Generator
        • Voice Transcriber
        • Voice Generator
      • Editor Tools
Powered by GitBook
On this page
  1. Quick Start

Text to Speech (TTS)

Convert written text into natural-sounding speech using AI voices.

Perfect for dialogue, narration, accessibility, or dynamic voice-over content — powered by ElevenLabs and other TTS providers.


✅ Basic Usage

AudioClip voice = await "Welcome to the future of AI voices."
    .GENSpeech()
    .SetModel(ElevenLabsModel.VoiceV2)
    .SetVoice(ElevenLabsVoice.Rachel)
    .SetSpeed(1.0f)
    .ExecuteAsync();

🔉 You’ll receive a Unity AudioClip, ready for playback or saving.


⚙️ Configuration Options

Method
Description

SetVoice(GenAIVoice)

Choose which AI voice to use (e.g., ElevenLabsVoice.Rachel)

SetSpeed(float)

Playback speed multiplier (e.g., 1.0 = normal)

SetSeed(uint)

Optional: generate deterministic output

SetOutputPath(path)

Save audio to specific path

SetOutputFormat(format)

Output format (MP3, WAV, PCM, etc.) — ElevenLabs only

SetModel(model)

Set the model (optional — defaults from settings)


🚀 Streaming TTS

Play audio in real-time as it’s generated — ideal for chat avatars or quick feedback loops.

await "Loading complete."
    .GENSpeech()
    .SetVoice(ElevenLabsVoice.Adam)
    .StreamAsync(myStreamAudioPlayer);

🎧 StreamAudioPlayer is a component that plays incoming audio chunks as they arrive.


📦 Output Formats (ElevenLabs)

Use .SetOutputFormat(...) to control file type:

Format
Description

OutputFormat.MPEG

Compact .mp3 format (default)

OutputFormat.PCM_S16LE_16

Raw PCM, 16-bit, mono, 16kHz

OutputFormat.WAV

Lossless .wav format (useful for editing)


🧠 Tips

  • Voices vary by provider. You can define your own GenAIVoice or use built-in constants.

  • For Unity playback, use .AsAudioClip() or .Play() extension methods.

  • If your TTS result sounds unnatural, try adjusting temperature, seed, or choosing a different voice.

PreviousSound Effect GenerationNextSpeech to Text (STT)

Last updated 18 days ago