espeak text to speech sounds very weird while running pyttsx3 code on ubuntu 20.04 LTS

Asked by Aman Kumar Singh on 2021-06-05

I am bit new to linux and I tried to run this python code. At the first time it asked me to install libespeak-dev and try to run the code again. After installing it when I ran the code the sound was very weird and very robotic and it was terrible to listen. Here is the code:

import pyttsx3

engine = pyttsx3.init()

def speak(text):
    engine.say(text)
    engine.runAndWait()

speak("Hello World and this is a test.")
When I tried to run the same code on windows 10, with the same python version, it sounded normal, but when I tried to run the code on ubuntu 20.04 LTS, it sounded very terrible.

For some reasons I am unable to attach the mp3 file to tell how terrible it sounds. By the way I am using Ubuntu 20.04 LTS which comes with default installation of python 3.8.5. Is there any fix to this? Because it sounds very bad. Thanks in advance...

Question information

Language:
English Edit question
Status:
Needs information
For:
Ubuntu alsa-driver Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Use a hosting site to hold the file and post the URL to the file. That's the reason you can't upload a file here. It is text only.

If you use espeak in a terminal, does it sound OK?

Can you help with this problem?

Provide an answer of your own, or ask Aman Kumar Singh for more information if necessary.

To post a message you must log in.