-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo(复件).py
50 lines (38 loc) · 1.29 KB
/
demo(复件).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
39
40
41
42
43
44
45
46
47
48
49
50
#coding=utf-8
import sys
from time import ctime, sleep
from offline_speech.SpeechSynthsis import SpeechSynthsis
def main():
synthsis = SpeechSynthsis(16000)
##### reset test
synthsis.append("音频重置重要")
synthsis.append("我爱北京")
i = 0
while True:
i = i + 1
if i == 11:
synthsis.reset()
print ("reset")
synthsis.append("音频重置,这是新的音频")
sleep(1)
if synthsis.playing():
print ('playing...')
if i == 15:
print ("add")
synthsis.append("这是新加的音频")
if i > 20 and synthsis.dataEmpty():
break
pass
#### performance test
# synthsis.append("这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, ")
# i = 0
# while True:
# if i < 100:
# i += 1
# synthsis.append("这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试, 这是性能测试,")
# sleep(1)
synthsis.close()
print ('finished')
return
if __name__ == '__main__':
main()