# print('number of voices',len(voices))
#>75
# uname -a
#>Debian 5.19.11-1kali2 (2022-10-10)
I agree with https://stackoverflow.com/users/453673/nav
The TTSX documentation needs an update.
Pattern is now something like this:
<voice id=english
name=english
languages=[b'\x02en-gb']
gender=male
age=None>
there are 75 lines in my distribution. So my basic python skill would suggest to me if we need an english voice, use something like:
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[13]) <!-- English GB
That's my preference.
To see this scribble a bit of code:
import pyttsx3
if __name__ == '__main__':
engine.pyttsx3.init()
voices = engine.getProperty('voices')
for x in voices:
print(x)
That should print out the list/table and we can choose our favorites there.
Note: in my version of pyttsx3 the docs say:
The Voice metadata
class pyttsx3.voice.Voice
Contains information about a speech synthesizer voice.
age - Integer age of the voice in years. Defaults to None if unknown.
gender - String gender of the voice: male, female, or neutral. Defaults to None if unknown.
id - String identifier of the voice. Used to set the active voice via pyttsx3.engine.Engine.setPropertyValue(). This attribute is always defined.
languages - List of string languages supported by this voice. Defaults to an empty list of unknown.
name - Human readable name of the voice. Defaults to None if unknown.
My personal favorite is 13 or 14th in the list which in my opinion is close to batman's Alfred Pennyworth. Of course he would be my choice in computer first fellow for my plans to take over the world!