Your Name 3 years ago
parent
commit
1a3d04f446
1 changed files with 53 additions and 0 deletions
  1. 53 0
      tests/tts2.py

+ 53 - 0
tests/tts2.py

@@ -0,0 +1,53 @@
+import pyttsx3
+import rpyc
+import random
+import time
+
+import sys
+
+engine = pyttsx3.init()
+#engine.say("I will speak this text")
+#engine.save_to_file("中文測試,我會講中文", 'test.mp3')
+engine.setProperty('rate',175)
+engine.say("你好,我是,集仕多股份有限公司,開發的,人工智慧主播,這是一個測試影片。我們與幸福空間合作,只要給我們影片的腳本文字檔案,我們立刻可以產生影片。", 'test.mp3')
+
+engine.runAndWait()
+sys.exit()
+
+
+fr=open('test.mp3','rb')
+fw=conn.builtins.open('/tmp/ok2.mp3','wb')
+
+while True:
+    b=fr.read(1024)
+    if b:
+        fw.write(b)
+    else:
+        break
+
+fr.close()
+fw.close()
+
+val=random.randint(1000000,9999999)
+ros.chdir('/home/jared/Wav2Lip-master')
+ros.system('./proc.sh '+str(val)+' &')
+
+
+while True:
+    print('waiting...')
+    if ros.path.exists('/tmp/results/'+str(val)):
+        break
+    time.sleep(5)
+    print('waiting...')
+
+fr=conn.builtins.open('/home/jared/Wav2Lip-master/results/result_voice.mp4','rb')
+fw=open('result.mp4','wb')
+while True:
+    b=fr.read(1024)
+    if b:
+        fw.write(b)
+    else:
+        break
+
+fr.close()
+fw.close()