alexa / avs-device-sdk

An SDK for commercial device makers to integrate Alexa directly into connected products.
https://developer.amazon.com/alexa/alexa-voice-service
Apache License 2.0
1.26k stars 602 forks source link

Third party keyword detectors #611

Closed PredigerChristof closed 6 years ago

PredigerChristof commented 6 years ago

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

Missing options to integrade other keyword detectors.

What is the expected behavior?

This alexa avs-device-sdk for Ubuntu Linux 16.04 LTS plays on an OrangePI zero with H3 (ARM7) quadcore processor with arbian Ubuntu Kernal. By doing this Step-by-Step insalling is only python2.7-dev missing. It can be olny installed without Wake word detector and key word detector. The precompiled versions of KITT.ai and Sensory did not work on 32Bit-Ubuntu. With out word detector it runs very good. The sample app has a smal keybord interface witch can be triggert in Ubuntu from a third party app. My qustion: Could you integrade an command like "s /tmp/micstream" and "x" to start streaming the mic-sampels in idel Alexa state to a pipe and stop streaming? So other keyword detectors can be integrated by using the keybord interface.

What behavior are you observing?

Provide the steps to reproduce the issue, if applicable:

Tell us about your environment:

What version of the AVS Device SDK are you using?

  <x.y.z>

Tell us what hardware you're using:

Tell us about your OS (Type & version):

BennyAvramson commented 6 years ago

Hi @PredigerChristof,

Currently, the SDK supports Sensory and Kitt.AI. If you want to implement support for another keyword engine, you'll need to implement AbstractKeywordDetector for that engine and and create it on SampleApplication.cpp similar to the way it's done for Sensory and Kitt.AI

Please let me know if you have other questions on this

Thanks, Benny

koter84 commented 6 years ago

i have a OrangePi Zero and i've compiled both Sensory and Snowbow/Kitt.ai on Armbian stretch the following is what i installed to get it working, this is a bit of copy-paste from my install-script so maybe i'm missing something here, but for the most part this should be what you need to compile alexa with the hotword engines

sudo apt-get install -y git gcc openssl libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good libgstreamer-plugins-bad1.0-dev gstreamer1.0-alsa gstreamer1.0-libav doxygen libsqlite3-dev libasound2-dev cmake clang-format gstreamer1.0-plugins-good gstreamer1.0-plugins-good-dbg repo libcurl3-dbg libcurl4-openssl-dev python-setuptools
sudo easy_install pip

portaudio:

cd ~/sdk-folder/third-party
wget -c http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
tar zxf pa_stable_v190600_20161030.tgz
cd portaudio
./configure --without-jack --without-oss
make

avs-device-sdk:

cd ~/sdk-folder/sdk-source
git clone --depth 1 https://github.com/alexa/avs-device-sdk.git
cd avs-device-sdk

for snowboy:

cd ~/sdk-folder/sdk-source/avs-device-sdk
sed -i s/' msToPushPerIteration.count()'/' static_cast<unsigned int>(msToPushPerIteration.count())'/ ./KWD/KittAi/src/KittAiKeyWordDetector.cpp
sed -i s/"set(CMAKE_CXX_EXTENSIONS OFF)"/"set(CMAKE_CXX_EXTENSIONS OFF)\nadd_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)"/ build/cmake/BuildOptions.cmake

cd ~/sdk-folder/third-party
sudo apt-get install -y swig3.0 python-pyaudio python3-pyaudio sox
pip install pyaudio
sudo apt-get install -y libatlas-base-dev
git clone --depth 1 https://github.com/Kitt-AI/snowboy.git
cd snowboy
# install models for tests
mkdir -p ~/sdk-folder/sdk-source/avs-device-sdk/KWD/inputs/KittAiModels
cp ./resources/common.res ~/sdk-folder/sdk-source/avs-device-sdk/KWD/inputs/KittAiModels/
cp ./resources/alexa/alexa-avs-sample-app/alexa.umdl ~/sdk-folder/sdk-source/avs-device-sdk/KWD/inputs/KittAiModels/
mkdir -p ~/sdk-folder/sdk-source/avs-device-sdk/Integration/inputs/KittAiModels
cp ./resources/common.res ~/sdk-folder/sdk-source/avs-device-sdk/Integration/inputs/KittAiModels/
cp ./resources/alexa/alexa-avs-sample-app/alexa.umdl ~/sdk-folder/sdk-source/avs-device-sdk/Integration/inputs/KittAiModels/
# install models for production
cp ./resources/alexa/alexa-avs-sample-app/alexa.umdl ./resources/

cd ~/sdk-folder/sdk-build
cmake -Wno-dev ${HOME}/sdk-folder/sdk-source/avs-device-sdk -DKITTAI_KEY_WORD_DETECTOR=ON -DKITTAI_KEY_WORD_DETECTOR_LIB_PATH=${HOME}/sdk-folder/third-party/snowboy/lib/rpi/libsnowboy-detect.a -DKITTAI_KEY_WORD_DETECTOR_INCLUDE_DIR=${HOME}/sdk-folder/third-party/snowboy/include -DGSTREAMER_MEDIA_PLAYER=ON -DPORTAUDIO=ON -DPORTAUDIO_LIB_PATH=${HOME}/sdk-folder/third-party/portaudio/lib/.libs/libportaudio.a -DPORTAUDIO_INCLUDE_DIR=${HOME}/sdk-folder/third-party/portaudio/include
time make

for Sensory:

cd ~/sdk-folder/third-party
git clone --depth 1 https://github.com/Sensory/alexa-rpi.git
cd alexa-rpi
./bin/license.sh;
# install models for tests
mkdir -p ~/sdk-folder/sdk-source/avs-device-sdk/KWD/inputs/SensoryModels
cp ./models/spot-alexa-rpi-31000.snsr ~/sdk-folder/sdk-source/avs-device-sdk/KWD/inputs/SensoryModels/
mkdir -p ~/sdk-folder/sdk-source/avs-device-sdk/Integration/inputs/SensoryModels
cp ./models/spot-alexa-rpi-31000.snsr ~/sdk-folder/sdk-source/avs-device-sdk/Integration/inputs/SensoryModels/

cd ~/sdk-folder/sdk-build
cmake -Wno-dev ${HOME}/sdk-folder/sdk-source/avs-device-sdk -DSENSORY_KEY_WORD_DETECTOR=ON -DSENSORY_KEY_WORD_DETECTOR_LIB_PATH=${HOME}/sdk-folder/third-party/alexa-rpi/lib/libsnsr.a -DSENSORY_KEY_WORD_DETECTOR_INCLUDE_DIR=${HOME}/sdk-folder/third-party/alexa-rpi/include -DGSTREAMER_MEDIA_PLAYER=ON -DPORTAUDIO=ON -DPORTAUDIO_LIB_PATH=${HOME}/sdk-folder/third-party/portaudio/lib/.libs/libportaudio.a -DPORTAUDIO_INCLUDE_DIR=${HOME}/sdk-folder/third-party/portaudio/include
time make
BennyAvramson commented 6 years ago

Hi @koter84,

I think @PredigerChristof objective is to support other keyword detectors besides Sensory and Snowboy, because the precompiled versions of them don't work for him on Ubuntu 32.

Thanks, Benny

PredigerChristof commented 6 years ago

Thank you, Both informations are grate I will try them. Thank you very mutch