Text to Speech can be used to read the large text file in audio format. You can read a book as a audiobook using this program. In this problem we will be using 'pyttsx3' python module.
pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.
Code :
import pyttsx3
text = open(r"text.txt")
read_text = text.readlines()
engine = pyttsx3.init()
for i in read_text:
engine.say(i)
engine.runAndWait()
Text file :
Output :
Explanation :
Firstly you have to install pyttsx3 on your system.
To do so, In terminal write the command 'pip install pyttsx3'. The module will be downloaded from the repository, it depends on your internet speed. If you face any error regarding the installation click here
import pyttsx module, then open the text file and read lines from it
then create a object using pyttsx3.init() and iterate a for loop through a text file.
Use say and runAndWait method which will say the word, wait and again run
1 Comments
ITオフショアとは?これは、システム開発者/ソフトウェア開発者の専門家であるもう 1 つの当事者にビジネス プロセスを委託することを含みます。 gjネットワーク
ReplyDeleteit オフショア と は
Ask Your Queries in the comments