forked from sayak-brm/espeakng-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_espeakng.py
More file actions
66 lines (48 loc) · 1.76 KB
/
test_espeakng.py
File metadata and controls
66 lines (48 loc) · 1.76 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /usr/bin/python3
# An eSpeak NG TTS binding for Python3.
# Copyright (C) 2016-2020 Sayak Brahmachari.
##
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 3 as published by
# the Free Software Foundation.
##
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
##
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
import espeakng
def test_espeakng():
print("Testing espeak4py\n")
mySpeaker = espeakng.Speaker()
mySpeaker.say("", wait4prev=True)
print("Testing wait4prev")
mySpeaker.say("Hello, World!")
time.sleep(1)
mySpeaker.say("Interrupted!")
time.sleep(3)
mySpeaker.say("Hello, World!")
time.sleep(1)
mySpeaker.say("Not Interrupted.", wait4prev=True)
time.sleep(3)
print("Testing pitch")
myHighPitchedSpeaker = espeakng.Speaker(pitch=99)
myHighPitchedSpeaker.say("I am a demo of the say function")
time.sleep(4)
print("Testing wpm")
myFastSpeaker = espeakng.Speaker(wpm=140)
myFastSpeaker.say("I am a demo of the say function")
print("Testing parameter overrides with say")
myFastSpeaker.say("I am a demo of the say function",
wait4prev=True,
wpm=240)
time.sleep(4)
print("Testing voice")
mySpanishSpeaker = espeakng.Speaker(voice="es")
mySpanishSpeaker.say("Hola. Como estas?")
print("Testing Completed.")
if __name__ == "__main__":
test_espeakng()