nateshmbhat / pyttsx3

Offline Text To Speech synthesis for python
Mozilla Public License 2.0
1.99k stars 321 forks source link

How to create the clear voice using pyttsx3 on Ubuntu? #292

Open GoldenDragon0710 opened 8 months ago

GoldenDragon0710 commented 8 months ago

I just used pyttsx3 for generating voice from the text with below code in Ubuntu 22.04. The voice was cracked and it was not clear when playing audio file. But I got the clean audio file when running the same code in Windows 10. How to create clear voice using pyttsx3 in Ubuntu 22.04?

import pyttsx3

engine = pyttsx3.init("espeak")
voices = engine.getProperty('voices')
engine.setProperty('rate', 160)
engine.setProperty("voice", voices[11].id)

# Save audio file
def speak(text):
    engine.say(text)
    engine.save_to_file(text, "output.wav")
    engine.runAndWait()

speak("Hello world and this is a test.")
Robert-Lau commented 7 months ago

Same problem, did you install espeak on Ubuntu?

subba-gh commented 6 months ago

Facing the same problem. I have installed espeak also. Still the same issue persists.