P
P
Python Newbie2021-08-06 14:46:28
Python
Python Newbie, 2021-08-06 14:46:28

How to change voice tone in pyttsx3 library?

There is a code that says the text:

import pyttsx3

engine = pyttsx3.init()

message = 'Текст для произношения'

print(message)
engine.say(message)
engine.runAndWait()

Pronunciation occurs with a strange synthesis.

How to change it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-08-06
@Levman5

If we slightly modify the example , we will see the available votes and their id.

engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
    print('Now speaking:', voice.id)
    engine.setProperty('voice', voice.id)
    engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()

The engine pulls the voices from the TTS settings in Windows, so additional voices need to be set there .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question