how to make a tts system useing pre existing audio files (GDScript)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kiwi_kid24

I plan to make a tts system in my game where the announcer can announce a players username and announce that they have scored the most points.

I do not have the best knowledge in gdscript so I would need code snippets to understand

my basic understanding is that i need a system to breakdown the words into its parts and then execute the audio file that corresponds to it
e.g

word: hello
parts: he, lo
files needed: "he.mp3" , "lo.mp3"
:bust_in_silhouette: Reply From: exuin

It’s more complex than that. If you want to break down each word into each syllable you have to account for differences in sounds between different words. I don’t think you need something that complex for your game. It would be better to just have pre-recorded sentences and play those instead.

:bust_in_silhouette: Reply From: stormreaver

I did something similar for a math game I made, allowing the game to speak numbers, and the results weren’t that bad. I recorded each number from zero through 20, the separate scaling factors (hundred, thousand, million, billion, trillion), then wrote a script to put them all together to speak a number. The results are obviously robotic, as I didn’t bother to record various inflections in accordance with where the clips were in the sentence, or even in the same word. It was going to be more work than I was willing to invest.

For generalized speech synthesis, which is what you’re implying, you’re looking at a ton of work for results that are going to sound painfully robotic (at the very least, you need to record leading, neutral, and trailing inflections for each possible syllable).

I think you’ll get better results by recording generic announcements and tying them to players in some other way.