Can we change the voice of the text to speech?

Godot Version

Question

Hello ! So I was wondering if we could change a bit the voice, or have another voice like a masculine voice or the very old text to speech ? Or maybe change the voice with the audio bus ?
Don’t know if it’s possible or not.

I believe your post contains the answer to your question already.
DisplayServer.tts_get_voices_for_language("en") returns a PackedStringArray, which the engine gets from the OS itself. You can get different voices by accessing different parts of the array.
Eg: voices[1], voices[2] etc…
But I would assume this changes from OS to OS, so it might sound different on another operating system.

okay because i’ve already tried it voice[2] and 1 ect, but it never worked so i assumed it wasn’t compatible. I’ll try to download more voice Thank you !

I’ve just tested it on my machine (macbook) and changing which voice I access in the array does indeed change correctly as it should. What OS are you using?

i am using windows and how did you change it ?

As I said, you need to simply access a different index of the array you get back. In your case, if the screenshot is your code, then simply change voices[0] to voices[1] or any other number.


I’ve tried but it gives me that error- tbh i don’t know how to acces the tts list

This seems to mean that your OS only supports a single voice.
To confirm this, you can simply print out the length of the array you get back and see.

You can use this:

print(voices.size())

Oh thx ! i’ve got only 2 voices( after i’ve done some update and new download) but i don’t think i’ll find the good voice in the windows tts

1 Like

This is cool. I didn’t know that feature even existed.