REACH Explorer
  • ❓Getting Started
  • 🖥️REACH Explorer
    • ⏬Downloads
    • 👤Create an Account
    • 👥Equip an Avatar
    • ⚡Blockchain
      • 💰Connect a Wallet
        • Cardano
        • Ethereum
    • ℹ️Support
      • 💻Device Requirements
      • 🌐How to Clear Browser Cache
    • ⚖️Terms of Service
  • 🛠️Metaverse Cloud Engine SDK
    • 🎮Unity Engine SDK
      • ⚠️Limits
      • ⬇️How to Install the SDK
      • 👤Create an Account
      • ⬆️Upload a Space
      • ⬆️Upload a Prefab
      • ⬆️Upload an Avatar
      • 🤳AR Experiences
      • 👀Content Visibility
      • 🎥Render Pipelines
      • 📂3D File Formats
      • 📜Custom Scripting
        • Custom JavaScript
          • Getting Started
          • Guidelines
      • 🔧Components
        • AI & Machine Learning
          • AI Agent
          • Text To Speech
        • Interactions
          • Metaverse Interactable
            • Non VR Animation
        • Networking
          • Network Object
          • Network Transform
          • Network Object RPC
          • Network Event
        • Blockchain
          • Blockchain GLB
          • Blockchain Query
        • Avatars
          • Player Avatar Container
        • General
          • Platform API
          • Video Camera API
        • Assets
          • Asset
            • Asset Meta Data
          • Meta Space
            • Meta Space Meta Data
          • Meta Prefab
            • Meta Prefab Meta Data
Powered by GitBook
On this page

Was this helpful?

  1. Metaverse Cloud Engine SDK
  2. Unity Engine SDK
  3. Components
  4. AI & Machine Learning

Text To Speech

TextToSpeech Documentation

The TextToSpeech component allows you to play text-to-speech (TTS) audio from a given text prompt. It can be used to give your Metaverse avatars a voice.

Namespace

MetaverseCloudEngine.Unity.AI.Components

Public Methods

  • void Play(): Plays the TTS audio from the text prompt.

Public Properties

  • string Text: The text prompt to convert to speech.

  • bool PlayOnStart: Whether or not to play the TTS audio when the component starts.

  • AudioSource VoiceSource: The AudioSource to play the TTS audio from.

  • TextToSpeechVoicePreset VoicePreset: The voice preset to use for the TTS audio.

Inspector Fields

  • TextPrompt text: The text prompt to convert to speech.

  • bool playOnStart: Whether or not to play the TTS audio when the component starts.

  • AudioSource voiceSource: The AudioSource to play the TTS audio from.

  • TextToSpeechVoicePreset voicePreset: The voice preset to use for the TTS audio.

Behavior

  • Execution Order: This class inherits from TriInspectorMonoBehaviour, which uses the default Unity execution order.

Usage

  1. To use TextToSpeech, start by adding the component to a GameObject in your scene.

  2. In the inspector, set the text property to the text prompt that you want to convert to speech.

  3. Optionally, set the voiceSource property to the AudioSource that you want to play the TTS audio from.

  4. Optionally, set the voicePreset property to the voice preset that you want to use.

  5. You can then use the Play() method to play the TTS audio.

Example:

You can use the TextToSpeech component to give your Metaverse avatar a voice. To do this:

  1. Add the TextToSpeech component to the avatar's GameObject.

  2. In the inspector, set the text property to the text that you want the avatar to say.

  3. Set the voiceSource property to the AudioSource that you want to play the TTS audio from.

  4. Call the Play() method to play the TTS audio.

This will play the TTS audio from the specified AudioSource, and the avatar will speak the text that you specified.

Additional Notes

  • The TextToSpeech component uses a third-party TTS service to convert text to speech.

  • The TextToSpeechVoicePreset class allows you to select different voices for the TTS audio.

PreviousAI AgentNextInteractions

Last updated 1 year ago

Was this helpful?

🛠️
🎮
🔧