0

I want to use gTTs instead of pyttsx3 as the tts engine in my program. Is it possible? Because pyttsx3 only has English language but I want to use my tts engine for filipino language, as a result, it is difficult for the tts engine to pronounce words correctly since it's default language is english. My speech to text engine has no problem detecting the foreign words, it's just the text to speech engine that is having a problem regarding with word pronunciation. My program goes like this

import speech_recognition as sr
import pyttsx3
from datetime import date


listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty("voices")
rate   = engine.getProperty("rate")
("Female Voice: {0}".format(voices[0].id))
engine.setProperty("rate",120)

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

while True:
    with sr.Microphone() as source:
        print('You can speak now')
        talk("You can speak now")
        voice = listener.listen(source)
        command = listener.recognize_google(voice)
    talk(command)
    print(command)
    if command == "date":
        talk(date.today())
    if command == "mola":
        talk("bola")
        print("bola")
    if command == "mork and means":
        talk("pork and beans")
        print("pork and beans")

I tried importing google-translate-new and gTTs but I can't figure out what commands and attribute to use when employing this text to speech engines.

0 Answers0