import pyttsx3
from time import sleep
names = ["Bee noy", "Om ana", "Namítha", "Thæjus" ]
speaker = pyttsx3.init()
for i in range(len(names)):
speaker.say(names[i])
sleep(1)
speaker.runAndWait()
***************************************************************************
https://www.youtube.com/watch?v=xj8u15bx9R8 (added on 14th Nov., 20)
# pip install pywin32
from win32com.client import Dispatch
s = Dispatch("SAPI.SpVoice")
s.speak("Hello world")
https://medium.com/@yashmahe2018/text-to-speech-in-python-6fd91800d060
bt7.bcrs@gmail.com Bantuda7
#1: Install
Packages
These
instructions are meant for Python 3.6, if you
have an older version you can upgrade or try to follow along, but the code
won’t be exactly the same. Make sure the following packages are installed:
pip install os
pip install gtts
#2: Import
Packages
import os
from gtts import gTTS
#3: Create the variable called text
text = "How are you doing
today?"
#4: Use the
package gTTS to create sounds that say the text.
obj = gTTS(text = text, slow = False)
#5: Save the sound in a .wav
file called “wavFile.wav”
obj.save("wavFile.wav")
#6: Playing the file
In this
step you will use the operating system to play the wav file.
os.system("start wavFile.wav")
No comments:
Post a Comment