Skip to content

Implementation of OpenAI's Text-To-Speech in Unity. Synthesize any text and play it via any AudioSource.

License

Notifications You must be signed in to change notification settings

fixiabis/OpenAI-Text-To-Speech-for-Unity

 
 

Repository files navigation

OpenAI Text-to-Speech Integration for Unity


Overview

This project integrates OpenAI's Text-to-Speech API into a Unity application, allowing users to convert and synthesize text to spoken audio within Unity via any AudioSource component. Tested with Unity version 2022.3.13f1.

Demo Video

Unity.TTS.Demo.mp4

Setup

  1. Download the latest release .unitypackage.
  2. Import it into your own project, e.g. via Assets > Import Package.
  3. Either open the OpenAI-TTS-Example scene, or add the necessary Prefabs to your own scene:

Using OpenAI TTS in your own scene

  1. Add OpenAI and TTSManager Prefabs to your scene.
  2. Add your OpenAI API key to the OpenAI-Prefab.
  • Optional: Change the TTSManager Prefab settings to your liking (useful if you want to have different entities with predefined voices, speeds, etc.)
  1. Call TTSManager.SynthesizeAndPlay of your TTSManager object.

Disclaimer

This project is a prototype and serves as a basic example of integrating OpenAI's TTS API with Unity. Feel free to create a PR.

About

Implementation of OpenAI's Text-To-Speech in Unity. Synthesize any text and play it via any AudioSource.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%