unitycoder / UnityRuntimeTextToSpeech

Runtime TTS plugin for unity, using espeak-ng (windows only)
GNU General Public License v3.0
63 stars 16 forks source link

Passing the audio through the unity audio system #1

Closed TheBricktop closed 4 years ago

TheBricktop commented 4 years ago

Hello is it possible to pass the generated audio data from espeakNG to the unity audiosource? Or this is using some windows dependant api for actual audio synthesis?

unitycoder commented 4 years ago

i'd like to do that also, and from a quick look last time, if you change AudioOutput to Retrieval, then it generates .wav file at project root (which could be loaded at runtime) https://github.com/unitycoder/UnityRuntimeTextToSpeech/blob/master/Assets/Libraries/eSpeakWrapper/Client.cs#L64

but i'd prefer to receive the audio bytes directly and just push that into audioclip data.. havent had time to look further yet.

unitycoder commented 4 years ago

someone has actually improved the system already here, can output to audio source: https://github.com/autious/UnityRuntimeTextToSpeech/commits/master

unitycoder commented 4 years ago

pulled changes from @autious fork to here, so now it outputs into AudioSource

autious commented 4 years ago

I made the changes to use this library for the global game jam. https://globalgamejam.org/2020/games/wet-robot-dreams-1

I needed to have access to the raw PCM data to apply some voice filtering. I made some additional changes, exposed more of the API to enable voice changes, and decoupled them in case there were any risks of threads overlapping. Source of it in use can be seen here:

https://github.com/autious/sexmachine

TheBricktop commented 4 years ago

Could you also add pull request? This lib is dynamically developing so this changes might add some good stuff to the main repo.

autious commented 4 years ago

I believe those changes are included in the pull that already occurred.

TheBricktop commented 4 years ago

oh alright, thank you then!

autious commented 4 years ago

No problem. Additionally, i suspect extending support for Linux and MacOSX shouldn't be far fetched, i've considered spending some time on it myself.

TheBricktop commented 4 years ago

Wow, thats awesome news, im mostly interested in mobile development so android and linux arm would be kinda straightforward, but ios woud be a pain in the guts