windows 10-64bit
I'm trying to use some text-to-speech tool to read text from lines of .txt document, something like this:
so with pyttsx:
import pyttsx
engine = pyttsx.init()
engine.say('my voice')
engine.runAndWait()
I got this error:
Traceback (most recent call last):
File "...", line 1, in <module>
import pyttsx
File "/.../pyttsx/__init__.py", line 18, in <module>
from engine import Engine
ImportError: No module named 'engine'
now gTTS, available as gtts_token, so how to use it? because this way module is unrecognizable:
import gtts
blabla = ("my voice")
tts = gtts.gTTS(text=blabla, lang='en')
tts.save("C:/rec.mp3")
or:
from gtts import gTTS
blabla = ("my voice")
tts = gTTS(text=blabla, lang='en')
tts.save("C:/rec.mp3")
error:
import gtts
ImportError: No module named 'gtts'
also I'm want try to use espeak but not sure how to install it, is it available with pip install or I have to install it some other way to try it:
import subprocess
text = '"my voice"'
subprocess.call('espeak '+text, shell=True)
or:
import os
os.system("espeak 'my voice'")
so I'm trying to find some solution, but everything I tried is not working here...
gtts
to the same version of python you are using. – Asthenicespeak
just go to the dowload section of the sourceforge site and once it is installed the code you provided should work but I'm not certain since I'm using a mac. good luck to you though! – Asthenicblabla = (line[0])
but first creates mp3 file, then if I want listen, I must call this mp3, so it is good but in my case I want avoid any audio files, need just read from text file. is it possible somehow use google voice to read my text file? I have not tried yet espeak... well if I can use only gTTS now have problem with mp3 file which I described in detail here because now it is a another question https://mcmap.net/q/1455309/-how-to-play-mp3 – Ecru