E
E
Elnurhan2019-05-27 19:01:44
Python
Elnurhan, 2019-05-27 19:01:44

How to change the speech synthesizer?

I installed RHVoice, but I have no idea how to install it. I'm just writing python code using the pyttsx3 library. but only english text is played

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan, 2019-05-31
@Elnurhan

Worked with the SAPI synthesizer directly without additional libraries. Here is a short list of required code for the example, commented out line by line:
import win32com.client
# get the synthesizer COM object
speaker = win32com.client.Dispatch("Sapi.SpVoice")
# get a list of all available voices in the system
voices = speaker.GetVoices()
# here I create a list of voice names
voices_names = [voice.GetDescription() for voice in voices]
# set the required synthesizer from the list of available ones. For example, the first one with index 0
speaker.Voice = voices[0]
# set the pronunciation rate from -10 to 10
speaker.Rate = 6
# set the voice volume from 0 to 100
speaker.Volume = 100
# say the phrase
speaker.Speak('Hello.')
In his article , he described the creation of the module in more detail, well, a piece of working with SAPI is given from there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question