I've made a simple text_to_speech function in python based on pyttsx3 library (in polish language).
import pyttsx3 as ttsengine = tts.init()engine.setProperty('rate', 130)engine.setProperty('voice', 'polish')def text_to_speech(text): engine.say(text) engine.runAndWait()
When I run this on windows the voice is tolerable, but in linux sounds teribble(windows 10 and ubuntu 18.04, pyttsx==2.9 on both machines).
I've also made for loop to print all available voices:
voices = engine.getProperty('voices')for voice in voices: print("Voice:") print("ID: %s" %voice.id) print("Name: %s" %voice.name) print("Age: %s" %voice.age) print("Gender: %s" %voice.gender) print("Languages Known: %s" %voice.languages)
Output in windows:
Voice: ID: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_PL-PL_PAULINA_11.0 Name: Microsoft Paulina Desktop - Polish Age: None Gender: None Languages Known: [] Voice: ID: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0 Name: Microsoft Zira Desktop - English (United States) Age: None Gender: None Languages Known: []
Output in linux:
Voice:ID: english-usName: english-usAge: NoneGender: maleLanguages Known: \[b'\\x02en-us'\]Voice:ID: polishName: polishAge: NoneGender: maleLanguages Known: \[b'\\x05pl'\]Voice:ID: brazilName: brazilAge: NoneGender: maleLanguages Known: \[b'\\x05pt-br'\]and a lot of other languages(...)
Is there a way to install other polish voices on linux version of pyttsx3 (or maybe other library)?