-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathnewstory09.py
38 lines (32 loc) · 1.33 KB
/
newstory09.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
mport pyttsx3
assistantVoice = int(input('''Select you assistants Voice
[1] DAVID
[2] HAZEL
[3] ZIRA : '''))
if assistantVoice == 1:
engine = pyttsx3.init("sapi5")
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[0].id)
elif assistantVoice == 2:
engine = pyttsx3.init("sapi5")
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)
elif assistantVoice == 3:
engine = pyttsx3.init("sapi5")
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[2].id)
else:
print("Invalid Input")
def speak(audio):
engine.say(audio)
engine.runAndWait()
r1= open("STORY_NO7.txt","r")
s1 = """Two friends and the Bear. Once there were two friends who were crossing the jungle. After some time they saw a bear coming towards them.
Then, one of the friends quickly climbed the nearby tree and the other one did not know how to climb the tree. So he lays down on the ground holding his breath.
The bear reaches near him and sniffs him in the ear. After some time bear left the place, thinking the man is dead.
Now the other friend climbs down and asked his friend, what did bear said to him in his ear? He replied,” to be safe from the fake friends.”"""
if __name__=="__main__":
for s1 in r1:
print(s1)
speak(s1)
r1.close()