summaryrefslogtreecommitdiff
path: root/jasper.py
diff options
context:
space:
mode:
Diffstat (limited to 'jasper.py')
-rwxr-xr-xjasper.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/jasper.py b/jasper.py
index 03f2071..7223469 100755
--- a/jasper.py
+++ b/jasper.py
@@ -9,8 +9,11 @@ import yaml
import argparse
from client.diagnose import Diagnostics
-from client import vocabcompiler, stt, jasperpath
-from client import speaker as speak
+from client import vocabcompiler, tts, stt, jasperpath
+
+# Add jasperpath.LIB_PATH to sys.path
+sys.path.append(jasperpath.LIB_PATH)
+
from client.conversation import Conversation
parser = argparse.ArgumentParser(description='Jasper Voice Control Center')
@@ -26,8 +29,6 @@ else:
# Change CWD to jasperpath.LIB_PATH
os.chdir(jasperpath.LIB_PATH)
-# Add jasperpath.LIB_PATH to sys.path
-sys.path.append(jasperpath.LIB_PATH)
class Jasper(object):
def __init__(self):
@@ -49,12 +50,19 @@ class Jasper(object):
stt_engine_type = "sphinx"
self._logger.warning("stt_engine not specified in profile, defaulting to '%s'", stt_engine_type)
+ try:
+ tts_engine_slug = self.config['tts_engine']
+ except KeyError:
+ tts_engine_slug = tts.get_default_engine_slug()
+ logger.warning("tts_engine not specified in profile, defaulting to '%s'", tts_engine_slug)
+ tts_engine_class = tts.get_engine_by_slug(tts_engine_slug)
+
# Compile dictionary
sentences, dictionary, languagemodel = [os.path.abspath(os.path.join(jasperpath.LIB_PATH, filename)) for filename in ("sentences.txt", "dictionary.dic", "languagemodel.lm")]
vocabcompiler.compile(sentences, dictionary, languagemodel)
# Initialize Mic
- self.mic = Mic(speak.newSpeaker(), stt.PocketSphinxSTT(), stt.newSTTEngine(stt_engine_type, api_key=api_key))
+ self.mic = Mic(tts_engine_class(), stt.PocketSphinxSTT(), stt.newSTTEngine(stt_engine_type, api_key=api_key))
def run(self):
if 'first_name' in self.config: