Snowboy API for AIY Voice Kit
Switch branches/tags
Nothing to show
Clone or download
Latest commit 2fb469b Jun 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mod replace to original snowboy resources May 29, 2018
.gitignore add snowboy.so May 28, 2018
LICENSE Initial commit May 28, 2018
README.md fix readme Jun 3, 2018
assistant_grpc_demo_snowboy.py Comment out the original program May 29, 2018
assistant_library_with_snowboy_demo.py add debug logger Jun 14, 2018

README.md

custom-hotword-for-aiy-voicekit

Snowboy API for AIY Voice Kit.
Replace your AIY Voice Kit hotword [OK. Google] to [alexa],[jarvis]...etc
You can easily replace your program.
See. diff AIY Voice Kit Press button and own hotword program

Before How to install

Buy The AIY Voice Kit and complete the tutorial.
custom-hotword-for-aiy-voicekit use lowlevel api AIY Voice Kit.

https://aiyprojects.withgoogle.com/voice/

Are you work your voice kit this program?

src/examples/voice/assistant_grpc_demo.py

If the demo has worked,next step.

How to install

cd /home/pi/
# libatlas-base-dev need snowboy module.
sudo apt-get install libatlas-base-dev
git clone https://github.com/senyoltw/custom-hotword-for-aiy-voicekit

# copy snowboy module and sample program.
cp -ipr custom-hotword-for-aiy-voicekit/mod AIY-projects-python/src/
cp -ip custom-hotword-for-aiy-voicekit/assistant_grpc_demo_snowboy.py AIY-projects-python/src/examples/voice/

How to use

cd AIY-voice-kit-python
chmod a+x src/examples/voice/assistant_grpc_demo_snowboy.py
src/examples/voice/assistant_grpc_demo_snowboy.py src/mod/resources/alexa/alexa_02092017.umdl

Say "alexa" and talk your google assistant!

sample log

pi@raspberrypi:~/AIY-voice-kit-python $ src/examples/voice/assistant_grpc_demo_snowboy.py src/mod/resources/alexa/alexa_02092017.umdl
/opt/aiy/projects-python/src/aiy/_drivers/_led.py:51: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(channel, GPIO.OUT)
[2018-06-03 14:33:26,194] INFO:recorder:started recording
Speak own hotword and speak
[2018-06-03 14:33:28,634] INFO:snowboy:Keyword 1 detected at time: 2018-06-03 14:33:28
Listening...
[2018-06-03 14:33:31,478] INFO:speech:transcript: What
[2018-06-03 14:33:31,483] INFO:speech:transcript: What is
[2018-06-03 14:33:31,485] INFO:speech:transcript: What is your
[2018-06-03 14:33:31,487] INFO:speech:transcript: What is 4
[2018-06-03 14:33:31,489] INFO:speech:transcript: What is よね
[2018-06-03 14:33:31,491] INFO:speech:transcript: What is your name
[2018-06-03 14:33:31,492] INFO:speech:transcript: What  is your name
[2018-06-03 14:33:31,494] INFO:speech:transcript: What is  your name
[2018-06-03 14:33:31,496] INFO:speech:event_type: 1
[2018-06-03 14:33:31,501] INFO:speech:transcript: What is your name
You said " What is your name "
Speak own hotword and speak

Make your own hotword

Make your own hotword this site.
and download your voice kit [hotword].pmdl
(how to make your hotword by snowboy, google it ^^!)

https://snowboy.kitt.ai/

and run program argument your hotword

cd AIY-voice-kit-python
src/examples/voice/assistant_grpc_demo_snowboy.py [hotword].pmdl

diff original program(AIY Voice Kit Press button), snowboy wakeword program

$ diff -u src/examples/voice/assistant_grpc_demo.py src/examples/voice/assistant_grpc_demo_snowboy.py
--- src/examples/voice/assistant_grpc_demo.py	2018-04-14 06:05:49.000000000 +0900
+++ src/examples/voice/assistant_grpc_demo_snowboy.py	2018-06-03 14:31:40.356212421 +0900
@@ -21,6 +21,16 @@
 import aiy.audio
 import aiy.voicehat

+import mod.snowboydecoder as snowboydecoder
+import sys
+
+if len(sys.argv) == 1:
+    print("Error: need to specify model name")
+    print("Usage: python demo.py your.model")
+    sys.exit(-1)
+
+model = sys.argv[1]
+
 logging.basicConfig(
     level=logging.INFO,
     format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s"
@@ -31,12 +41,15 @@
     status_ui = aiy.voicehat.get_status_ui()
     status_ui.status('starting')
     assistant = aiy.assistant.grpc.get_assistant()
-    button = aiy.voicehat.get_button()
+    #button = aiy.voicehat.get_button()
+    detector = snowboydecoder.HotwordDetector(model, sensitivity=0.5)
     with aiy.audio.get_recorder():
         while True:
             status_ui.status('ready')
-            print('Press the button and speak')
-            button.wait_for_press()
+            #print('Press the button and speak')
+            print('Speak own hotword and speak')
+            #button.wait_for_press()
+            detector.start()
             status_ui.status('listening')
             print('Listening...')
             text, audio = assistant.recognize()
pi@raspberrypi:~/AIY-voice-kit-python $