nico 8 роки тому
батько
коміт
3b8f019229

+ 5 - 2
core/Neurone.py

@@ -1,10 +1,13 @@
+import importlib
+
 
 class Neurone:
     def __init__(self):
         # Here we load the stt and tts from settings
         self.stt = "snowboy"
-        self.tts = ""
+        self.tts = "pico2wave"
 
     def say(self, message):
         # here we use the tts to make jarvis talk
-        pass
+        tts_backend = importlib.import_module("tts." + self.tts)
+        tts_backend.say(message)

+ 0 - 0
plugins/system_date/system_date.py → neurons/system_date/system_date.py


+ 4 - 0
test.py

@@ -0,0 +1,4 @@
+from core import Neurone
+
+neurone = Neurone()
+neurone.say("oui monsieur?")

+ 0 - 0
tts/__init__.py


+ 1 - 0
tts/pico2wave/__init__.py

@@ -0,0 +1 @@
+from pico2wave import *

+ 10 - 0
tts/pico2wave/pico2wave.py

@@ -0,0 +1,10 @@
+import subprocess
+import os
+
+
+def say(words):
+    tempfile = "temp.wav"
+    devnull = open("/dev/null", "w")
+    subprocess.call(["pico2wave", "-l=fr-FR", "-w", tempfile, words], stderr=devnull)
+    subprocess.call(["aplay", tempfile], stderr=devnull)
+    os.remove(tempfile)