From 8ce9ca577d031e58bfe3590815093c86b755c70d Mon Sep 17 00:00:00 2001 From: lucianom Date: Mon, 4 Jul 2022 12:51:54 +0100 Subject: [PATCH 01/20] Removed unnecessary declarations --- .../XMOS/include/XMOS/XMOSKeywordDetector.h | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/applications/acsdkXMOSAdapter/XMOS/include/XMOS/XMOSKeywordDetector.h b/applications/acsdkXMOSAdapter/XMOS/include/XMOS/XMOSKeywordDetector.h index b6cecb35ba..029a4c4934 100644 --- a/applications/acsdkXMOSAdapter/XMOS/include/XMOS/XMOSKeywordDetector.h +++ b/applications/acsdkXMOSAdapter/XMOS/include/XMOS/XMOSKeywordDetector.h @@ -52,44 +52,6 @@ class XMOSKeywordDetector : public acsdkKWDImplementations::AbstractKeywordDetec public: - /** - * Creates an @c XMOSKeywordDetector - * - * @param stream The stream of audio data. This should be formatted in LPCM encoded with 16 bits per sample and - * have a sample rate of 16 kHz. Additionally, the data should be in little endian format. - * @param audioFormat The format of the audio data located within the stream. - * @param keyWordNotifier The object with which to notifiy observers of keyword detections. - * @param KeyWordDetectorStateNotifier The object with which to notify observers of state changes in the engine. - * @param msToPushPerIteration The amount of data in milliseconds to push to the cloud at a time. This was the amount used by - * Sensory in example code. - */ - static std::unique_ptr create( - const std::shared_ptr stream, - const std::shared_ptr& audioFormat, - std::shared_ptr keyWordNotifier, - std::shared_ptr KeyWordDetectorStateNotifier, - std::chrono::milliseconds msToPushPerIteration = std::chrono::milliseconds(10)); - - /** - * @deprecated - * Creates an @c XMOSKeywordDetector - * - * @param stream The stream of audio data. This should be formatted in LPCM encoded with 16 bits per sample and - * have a sample rate of 16 kHz. Additionally, the data should be in little endian format. - * @param audioFormat The format of the audio data located within the stream. - * @param keyWordObservers The observers to notify of keyword detections. - * @param keyWordDetectorStateObservers The observers to notify of state changes in the engine. - * @param msToPushPerIteration The amount of data in milliseconds to push to the cloud at a time. This was the amount used by - * Sensory in example code. - * @return A new @c XMOSKeywordDetector, or @c nullptr if the operation failed. - */ - static std::unique_ptr create( - const std::shared_ptr stream, - avsCommon::utils::AudioFormat audioFormat, - std::unordered_set> keyWordObservers, - std::unordered_set> keyWordDetectorStateObservers, - std::chrono::milliseconds msToPushPerIteration = std::chrono::milliseconds(10)); - /** * Destructor. */ From 4915e0943922365184d148d1cc4d927e16f9a7c5 Mon Sep 17 00:00:00 2001 From: lucianom Date: Mon, 4 Jul 2022 14:01:50 +0100 Subject: [PATCH 02/20] Update CLI options --- tools/Install/pi.sh | 47 +++++++++++++++++++++++------------------- tools/Install/setup.sh | 29 +++++++------------------- 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/tools/Install/pi.sh b/tools/Install/pi.sh index ad7a4679cd..8ad5742d9e 100644 --- a/tools/Install/pi.sh +++ b/tools/Install/pi.sh @@ -28,18 +28,15 @@ show_help() { echo 'Usage: pi.sh [OPTIONS]' echo '' echo 'Optional parameters' - echo ' -G Flag to enable keyword detector on GPIO interrupt' - echo ' -H Flag to enable keyword detector on HID event' + echo ' -w Keyword detector to setup: possible values are S (Sensory), A (Amazon), G (GPIO trigger), H (HID trigger), default is no keyword detector, only tap-to-talk is enabled' echo ' -h Display this help and exit' } -OPTIONS=GHh +KEY_WORD_DETECTOR_FLAG="" +OPTIONS=w:h while getopts "$OPTIONS" opt ; do case $opt in - G ) - GPIO_KEY_WORD_DETECTOR_FLAG="ON" - ;; - H ) - HID_KEY_WORD_DETECTOR_FLAG="ON" + w ) + KEY_WORD_DETECTOR_FLAG="$OPTARG" ;; h ) show_help @@ -59,18 +56,26 @@ CMAKE_PLATFORM_SPECIFIC=(-DGSTREAMER_MEDIA_PLAYER=ON \ -DCURL_LIBRARY=${THIRD_PARTY_PATH}/curl-${CURL_VER}/lib/.libs/libcurl.so) # Add the flags for the different keyword detectors -if [ -n "$SENSORY_KEY_WORD_DETECTOR_FLAG" ] -then - CMAKE_PLATFORM_SPECIFIC+=(-DSENSORY_KEY_WORD_DETECTOR=ON \ - -DSENSORY_KEY_WORD_DETECTOR_LIB_PATH=$THIRD_PARTY_PATH/alexa-rpi/lib/libsnsr.a \ - -DSENSORY_KEY_WORD_DETECTOR_INCLUDE_DIR=$THIRD_PARTY_PATH/alexa-rpi/include) -elif [ -n "$GPIO_KEY_WORD_DETECTOR_FLAG" ] -then - CMAKE_PLATFORM_SPECIFIC+=(-DGPIO_KEY_WORD_DETECTOR=ON) -elif [ -n "$HID_KEY_WORD_DETECTOR_FLAG" ] -then - CMAKE_PLATFORM_SPECIFIC+=(-DHID_KEY_WORD_DETECTOR=ON) -fi +case $KEY_WORD_DETECTOR_FLAG in + S ) + # Set CMAKE options for Sensory Keyword detector + CMAKE_PLATFORM_SPECIFIC+=(-DSENSORY_KEY_WORD_DETECTOR=ON \ + -DSENSORY_OP_POINT_FLAG=ON \ + -DXMOS_AVS_TESTS_FLAG=ON \ + -DSENSORY_KEY_WORD_DETECTOR_LIB_PATH=$THIRD_PARTY_PATH/alexa-rpi/lib/libsnsr.a \ + -DSENSORY_KEY_WORD_DETECTOR_INCLUDE_DIR=$THIRD_PARTY_PATH/alexa-rpi/include) + ;; + A )) + # Set CMAKE options for Amazon Keyword detector + # CMAKE_PLATFORM_SPECIFIC+=( ... ) + ;; + G )) + CMAKE_PLATFORM_SPECIFIC+=(-DGPIO_KEY_WORD_DETECTOR=ON) + ;; + H )) + CMAKE_PLATFORM_SPECIFIC+=(-DHID_KEY_WORD_DETECTOR=ON) + ;; +esac GSTREAMER_AUDIO_SINK="alsasink" @@ -82,7 +87,7 @@ install_dependencies() { run_os_specifics() { build_port_audio build_curl - if [ [ -z $GPIO_KEY_WORD_DETECTOR_FLAG ] && [ -z $HID_KEY_WORD_DETECTOR_FLAG ] && [ -z $SENSORY_KEY_WORD_DETECTOR_FLAG ] ] + if [ [ -z $KEY_WORD_DETECTOR_FLAG ] ] then echo echo "==============> TAP-TO-TALK IS ENABLED ==============" diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index 18981b61ac..6a999f6ba5 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -62,9 +62,6 @@ PATH_FILES_DIR="$HOME/.config/" VOCALFUSION_3510_SALES_DEMO_PATH_FILE="$PATH_FILES_DIR/vocalfusion_3510_sales_demo_path" VOCALFUSION_3510_AVS_SETUP_PATH_FILE="$PATH_FILES_DIR/vocalfusion_3510_avs_setup_path" PI_HAT_CTRL_PATH="$THIRD_PARTY_PATH/pi_hat_ctrl" -SENSORY_KEY_WORD_DETECTOR_FLAG="" -GPIO_KEY_WORD_DETECTOR_FLAG="" -HID_KEY_WORD_DETECTOR_FLAG="" ALIASES="$HOME/.bash_aliases" # Default value for XMOS device @@ -137,7 +134,7 @@ show_help() { echo ' -i PKCS#11 user pin to access key object functions.' echo ' -k PKCS#11 key object label.' echo ' -x XMOS device to setup: possible values are xvf3100, xvf3500, xvf3510, xvf3600-slave, xvf3600-master, or xvf3610, default is xvf3510' - echo ' -g Flag to enable keyword detector on GPIO interrupt' + echo ' -w Keyword detector to setup: possible values are S (Sensory), A (Amazon), G (GPIO trigger), H (HID trigger), default is no keyword detector, only tap-to-talk is enabled' echo ' -h Display this help and exit' } @@ -157,7 +154,9 @@ XMOS_TAG=$2 shift 2 -OPTIONS=s:a:d:hp:k:i:t:m:x:GHh +KEY_WORD_DETECTOR_FLAG="" + +OPTIONS=s:a:d:hp:k:i:t:m:x:w:h while getopts "$OPTIONS" opt ; do case $opt in s ) @@ -180,11 +179,8 @@ while getopts "$OPTIONS" opt ; do x ) XMOS_DEVICE="$OPTARG" ;; - G ) - GPIO_KEY_WORD_DETECTOR_FLAG="-G" - ;; - H ) - HID_KEY_WORD_DETECTOR_FLAG="-H" + w ) + KEY_WORD_DETECTOR_FLAG="-w $OPTARG" ;; h ) show_help @@ -258,7 +254,7 @@ PLATFORM=${PLATFORM:-$(get_platform)} if [ "$PLATFORM" == "Raspberry pi" ] then - PI_CMD="pi.sh ${SENSORY_KEY_WORD_DETECTOR_FLAG} ${GPIO_KEY_WORD_DETECTOR_FLAG} ${HID_KEY_WORD_DETECTOR_FLAG}" + PI_CMD="pi.sh ${KEY_WORD_DETECTOR_FLAG}" echo "Running command ${PI_CMD}" source $PI_CMD elif [ "$PLATFORM" == "Windows mingw64" ] @@ -398,15 +394,6 @@ while true; do esac done -if [ -n "$SENSORY_KEY_WORD_DETECTOR_FLAG" ] -then - SENSORY_OP_POINT_FLAG="-DSENSORY_OP_POINT=ON" - XMOS_AVS_TESTS_FLAG="-DXMOS_AVS_TESTS=ON" -else - SENSORY_OP_POINT_FLAG="-DSENSORY_OP_POINT=OFF" - XMOS_AVS_TESTS_FLAG="-DXMOS_AVS_TESTS=OFF" -fi - if [ $XMOS_DEVICE = "xvf3510" ] then PI_HAT_FLAG="-DPI_HAT_CTRL=ON" @@ -464,9 +451,7 @@ then mkdir -p $BUILD_PATH cd $BUILD_PATH cmake "$SOURCE_PATH/avs-device-sdk" \ - $SENSORY_OP_POINT_FLAG \ $PI_HAT_FLAG \ - $XMOS_AVS_TESTS_FLAG \ -DCMAKE_BUILD_TYPE=DEBUG \ -DPKCS11=$ACSDK_PKCS11 \ "${CMAKE_PLATFORM_SPECIFIC[@]}" From 530fcf61c67bda6db9748ed91e90d0f06137f5df Mon Sep 17 00:00:00 2001 From: lucianom Date: Mon, 4 Jul 2022 14:09:55 +0100 Subject: [PATCH 03/20] Fix syntax errors --- tools/Install/pi.sh | 8 ++++---- tools/Install/setup.sh | 9 ++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/tools/Install/pi.sh b/tools/Install/pi.sh index 8ad5742d9e..de74fcec74 100644 --- a/tools/Install/pi.sh +++ b/tools/Install/pi.sh @@ -65,14 +65,14 @@ case $KEY_WORD_DETECTOR_FLAG in -DSENSORY_KEY_WORD_DETECTOR_LIB_PATH=$THIRD_PARTY_PATH/alexa-rpi/lib/libsnsr.a \ -DSENSORY_KEY_WORD_DETECTOR_INCLUDE_DIR=$THIRD_PARTY_PATH/alexa-rpi/include) ;; - A )) + A ) # Set CMAKE options for Amazon Keyword detector - # CMAKE_PLATFORM_SPECIFIC+=( ... ) + CMAKE_PLATFORM_SPECIFIC+="" ;; - G )) + G ) CMAKE_PLATFORM_SPECIFIC+=(-DGPIO_KEY_WORD_DETECTOR=ON) ;; - H )) + H ) CMAKE_PLATFORM_SPECIFIC+=(-DHID_KEY_WORD_DETECTOR=ON) ;; esac diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index 6a999f6ba5..f7809ae03a 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -326,13 +326,8 @@ echo AUTOSTART_SESSION="avsrun" AUTOSTART_DIR=$HOME/.config/lxsession/LXDE-pi AUTOSTART=$AUTOSTART_DIR/autostart -AVSRUN_CMD="lxterminal -t avsrun -e \"$BUILD_PATH/SampleApp/src/SampleApp $OUTPUT_CONFIG_FILE " -if [ -n "$SENSORY_KEY_WORD_DETECTOR_FLAG" ]; then - AVSRUN_CMD+="$THIRD_PARTY_PATH/alexa-rpi/models NONE 12 \$*" #$* is for passing any extra arguments to Sampleapp through .avsrun-startup.sh shell script -else - AVSRUN_CMD+="NONE" -fi -AVSRUN_CMD+="\" &" +AVSRUN_CMD="lxterminal -t avsrun -e \"$BUILD_PATH/SampleApp/src/SampleApp $OUTPUT_CONFIG_FILE NONE\" & " + STARTUP_SCRIPT=$CURRENT_DIR/.avsrun-startup.sh if [ ! -f $AUTOSTART ]; then mkdir -p $AUTOSTART_DIR From 30c7cb39b0cd85edffdaef97cd5e7e11a2fa421c Mon Sep 17 00:00:00 2001 From: lucianom Date: Mon, 4 Jul 2022 20:40:56 +0100 Subject: [PATCH 04/20] Do not pass keyword detector type to pi.sh via CLI argument, as pi.sh is called from within setup.sh. --- tools/Install/pi.sh | 21 --------------------- tools/Install/setup.sh | 6 +++--- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/tools/Install/pi.sh b/tools/Install/pi.sh index de74fcec74..461b998b95 100644 --- a/tools/Install/pi.sh +++ b/tools/Install/pi.sh @@ -24,27 +24,6 @@ if [ -z "$PLATFORM" ]; then exit 1 fi -show_help() { - echo 'Usage: pi.sh [OPTIONS]' - echo '' - echo 'Optional parameters' - echo ' -w Keyword detector to setup: possible values are S (Sensory), A (Amazon), G (GPIO trigger), H (HID trigger), default is no keyword detector, only tap-to-talk is enabled' - echo ' -h Display this help and exit' -} -KEY_WORD_DETECTOR_FLAG="" -OPTIONS=w:h -while getopts "$OPTIONS" opt ; do - case $opt in - w ) - KEY_WORD_DETECTOR_FLAG="$OPTARG" - ;; - h ) - show_help - exit 1 - ;; - esac -done - SOUND_CONFIG="$HOME/.asoundrc" START_SCRIPT="$INSTALL_BASE/startsample.sh" START_PREVIEW_SCRIPT="$INSTALL_BASE/startpreview.sh" diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index f7809ae03a..a5fc5107ce 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -180,7 +180,7 @@ while getopts "$OPTIONS" opt ; do XMOS_DEVICE="$OPTARG" ;; w ) - KEY_WORD_DETECTOR_FLAG="-w $OPTARG" + KEY_WORD_DETECTOR_FLAG="$OPTARG" ;; h ) show_help @@ -254,8 +254,8 @@ PLATFORM=${PLATFORM:-$(get_platform)} if [ "$PLATFORM" == "Raspberry pi" ] then - PI_CMD="pi.sh ${KEY_WORD_DETECTOR_FLAG}" - echo "Running command ${PI_CMD}" + PI_CMD="pi.sh" + echo "Running command \"${PI_CMD}\" with KEY_WORD_DETECTOR_FLAG set to \"${KEY_WORD_DETECTOR_FLAG}\"" source $PI_CMD elif [ "$PLATFORM" == "Windows mingw64" ] then From 4d896655953b95b9ce0bab783f42cf9b8e41ffad Mon Sep 17 00:00:00 2001 From: lucianom Date: Mon, 4 Jul 2022 21:15:44 +0100 Subject: [PATCH 05/20] Add info --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34d020a2c6..293cff9bb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Feature enhancements, updates, and resolved issues from all releases are availab **XMOS-only change** - version 0: + * refactor CLI arguments in setup scripts in order to support Amazon KWD * port XMOS KWD adapters to latest version of the SDK * delay startup of AVS console till .asoundrc file is found From 8141c412aa389762434ea974dd4d98d049967f55 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 5 Jul 2022 14:35:42 +0100 Subject: [PATCH 06/20] Fix merge errors --- tools/Install/pi.sh | 31 +------------------------------ tools/Install/setup.sh | 3 --- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/tools/Install/pi.sh b/tools/Install/pi.sh index ecb34c87ae..6277297973 100644 --- a/tools/Install/pi.sh +++ b/tools/Install/pi.sh @@ -24,35 +24,6 @@ if [ -z "$PLATFORM" ]; then exit 1 fi -show_help() { - echo 'Usage: pi.sh [OPTIONS]' - echo '' - echo 'Optional parameters' - echo ' -G Flag to enable keyword detector on GPIO interrupt' - echo ' -H Flag to enable keyword detector on HID event' - echo ' -S Flag to enable Sensory keyword detector' - echo ' -h Display this help and exit' -} -OPTIONS=GHSh -while getopts "$OPTIONS" opt ; do - case $opt in - G ) - GPIO_KEY_WORD_DETECTOR_FLAG="ON" - ;; - H ) - HID_KEY_WORD_DETECTOR_FLAG="ON" - ;; - S ) - SENSORY_KEY_WORD_DETECTOR_FLAG="ON" - ;; - - h ) - show_help - exit 1 - ;; - esac -done - SOUND_CONFIG="$HOME/.asoundrc" START_SCRIPT="$INSTALL_BASE/startsample.sh" START_PREVIEW_SCRIPT="$INSTALL_BASE/startpreview.sh" @@ -67,7 +38,7 @@ CMAKE_PLATFORM_SPECIFIC=(-DGSTREAMER_MEDIA_PLAYER=ON \ case $KEY_WORD_DETECTOR_FLAG in S ) # Set CMAKE options for Sensory Keyword detector - CMAKE_PLATFORM_SPECIFIC+=(-DSENSORY_KEY_WORD_DETECTOR=ON \ + CMAKE_PLATFORM_SPECIFIC+=(-DSENSORY_KEY_WORD_DETECTOR=ON \ -DSENSORY_OP_POINT_FLAG=ON \ -DXMOS_AVS_TESTS_FLAG=ON \ -DSENSORY_KEY_WORD_DETECTOR_LIB_PATH=$THIRD_PARTY_PATH/alexa-rpi/lib/libsnsr.a \ diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index c8f5279aa6..a5fc5107ce 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -182,9 +182,6 @@ while getopts "$OPTIONS" opt ; do w ) KEY_WORD_DETECTOR_FLAG="$OPTARG" ;; - S ) - SENSORY_KEY_WORD_DETECTOR_FLAG="-S" - ;; h ) show_help exit 1 From 1cc82e227388d3cc4256d208371d3762e1aa1099 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 5 Jul 2022 15:41:25 +0100 Subject: [PATCH 07/20] Use github repo to download portaudion --- tools/Install/setup.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index a5fc5107ce..974e296b53 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -25,8 +25,10 @@ set -o nounset # Exit the script if any uninitialized variable is used. CLONE_URL=${CLONE_URL:- 'https://github.com/xmos/avs-device-sdk.git'} -PORT_AUDIO_FILE="pa_stable_v190600_20161030.tgz" -PORT_AUDIO_DOWNLOAD_URL="http://www.portaudio.com/archives/$PORT_AUDIO_FILE" +#PORT_AUDIO_FILE="pa_stable_v190600_20161030.tgz" +#PORT_AUDIO_DOWNLOAD_URL="https://github.com/PortAudio/portaudio/releases/tag/pa_stable_v190600_20161030" +PORT_AUDIO_TAG="pa_stable_v190600_20161030" +PORT_AUDIO_CLONE_URL="https://github.com/PortAudio/portaudio" CURL_VER=7.67.0 CURL_DOWNLOAD_URL="https://github.com/curl/curl/releases/download/curl-7_67_0/curl-${CURL_VER}.tar.gz" @@ -90,9 +92,12 @@ build_port_audio() { echo "==============> BUILDING PORT AUDIO ==============" echo pushd $THIRD_PARTY_PATH - wget -c $PORT_AUDIO_DOWNLOAD_URL - tar zxf $PORT_AUDIO_FILE + # wget -c $PORT_AUDIO_DOWNLOAD_URL + # tar zxf $PORT_AUDIO_FILE + # Use giuthub repo for portaudio as it is more reliable than the website + git clone -v PORT_AUDIO_TAG -v PORT_AUDIO_CLONE_URL + mv PORT_AUDIO_TAG portaudio pushd portaudio ./configure --without-jack make From 86280e9cd678f74b6a3b95f2764603e2e8df4e1b Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 5 Jul 2022 15:43:12 +0100 Subject: [PATCH 08/20] Fix command --- tools/Install/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index 974e296b53..4282f8cfe4 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -96,7 +96,7 @@ build_port_audio() { # tar zxf $PORT_AUDIO_FILE # Use giuthub repo for portaudio as it is more reliable than the website - git clone -v PORT_AUDIO_TAG -v PORT_AUDIO_CLONE_URL + git clone -v $PORT_AUDIO_TAG $PORT_AUDIO_CLONE_URL mv PORT_AUDIO_TAG portaudio pushd portaudio ./configure --without-jack From a295fb597cc841edbfccd8bb47d3df4758bae6a3 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 5 Jul 2022 15:45:20 +0100 Subject: [PATCH 09/20] Fix command --- tools/Install/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index 4282f8cfe4..d2f65e7190 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -97,7 +97,7 @@ build_port_audio() { # Use giuthub repo for portaudio as it is more reliable than the website git clone -v $PORT_AUDIO_TAG $PORT_AUDIO_CLONE_URL - mv PORT_AUDIO_TAG portaudio + mv $PORT_AUDIO_TAG portaudio pushd portaudio ./configure --without-jack make From a76742c0fa9607909d122325d8a1071d1725c33c Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 5 Jul 2022 19:24:39 +0100 Subject: [PATCH 10/20] Update git clone command --- tools/Install/setup.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index d2f65e7190..ef3e18bce1 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -25,10 +25,11 @@ set -o nounset # Exit the script if any uninitialized variable is used. CLONE_URL=${CLONE_URL:- 'https://github.com/xmos/avs-device-sdk.git'} -#PORT_AUDIO_FILE="pa_stable_v190600_20161030.tgz" -#PORT_AUDIO_DOWNLOAD_URL="https://github.com/PortAudio/portaudio/releases/tag/pa_stable_v190600_20161030" +# PORT_AUDIO_FILE="pa_stable_v190600_20161030.tgz" +# PORT_AUDIO_DOWNLOAD_URL="https://github.com/PortAudio/portaudio/releases/tag/pa_stable_v190600_20161030" PORT_AUDIO_TAG="pa_stable_v190600_20161030" -PORT_AUDIO_CLONE_URL="https://github.com/PortAudio/portaudio" +PORT_AUDIO_CLONE_URL="https://github.com/PortAudio/portaudio/releases/tag/${PORT_AUDIO_TAG}.tar.gz" +PORT_AUDIO_DIR="portaudio" CURL_VER=7.67.0 CURL_DOWNLOAD_URL="https://github.com/curl/curl/releases/download/curl-7_67_0/curl-${CURL_VER}.tar.gz" @@ -95,10 +96,9 @@ build_port_audio() { # wget -c $PORT_AUDIO_DOWNLOAD_URL # tar zxf $PORT_AUDIO_FILE - # Use giuthub repo for portaudio as it is more reliable than the website - git clone -v $PORT_AUDIO_TAG $PORT_AUDIO_CLONE_URL - mv $PORT_AUDIO_TAG portaudio - pushd portaudio + # Download portaudio from github as it is more reliable than the website + git clone -b $PORT_AUDIO_TAG $PORT_AUDIO_CLONE_URL $PORT_AUDIO_DIR + pushd $PORT_AUDIO_DIR ./configure --without-jack make popd From 9584c76b7b89a2f13a43fadb98f865570910f947 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 5 Jul 2022 20:07:53 +0100 Subject: [PATCH 11/20] Update git clone command --- tools/Install/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index ef3e18bce1..aea97acd5b 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -28,7 +28,7 @@ CLONE_URL=${CLONE_URL:- 'https://github.com/xmos/avs-device-sdk.git'} # PORT_AUDIO_FILE="pa_stable_v190600_20161030.tgz" # PORT_AUDIO_DOWNLOAD_URL="https://github.com/PortAudio/portaudio/releases/tag/pa_stable_v190600_20161030" PORT_AUDIO_TAG="pa_stable_v190600_20161030" -PORT_AUDIO_CLONE_URL="https://github.com/PortAudio/portaudio/releases/tag/${PORT_AUDIO_TAG}.tar.gz" +PORT_AUDIO_CLONE_URL="https://github.com/PortAudio/portaudio" PORT_AUDIO_DIR="portaudio" CURL_VER=7.67.0 @@ -97,7 +97,7 @@ build_port_audio() { # tar zxf $PORT_AUDIO_FILE # Download portaudio from github as it is more reliable than the website - git clone -b $PORT_AUDIO_TAG $PORT_AUDIO_CLONE_URL $PORT_AUDIO_DIR + git clone -b $PORT_AUDIO_TAG $PORT_AUDIO_CLONE_URL pushd $PORT_AUDIO_DIR ./configure --without-jack make From 4c436ed2e55c7234570f965eec2a4a48ddbb4102 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 5 Jul 2022 20:16:11 +0100 Subject: [PATCH 12/20] Add info --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 293cff9bb2..bc16dc4476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Feature enhancements, updates, and resolved issues from all releases are availab * refactor CLI arguments in setup scripts in order to support Amazon KWD * port XMOS KWD adapters to latest version of the SDK * delay startup of AVS console till .asoundrc file is found + * clone portaudio from github instead of using wget as it is more reliable ### Version 1.25.0 - August 23 2021 Feature enhancements, updates, and resolved issues from all releases are available on the [Amazon developer portal](https://developer.amazon.com/docs/alexa/avs-device-sdk/release-notes.html) From 3b0c298b73e80e638ab94e8ca8573a0325ebd1f4 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 08:53:11 +0100 Subject: [PATCH 13/20] Protect code --- .../acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h b/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h index ece68c202a..2e00ea1e67 100644 --- a/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h +++ b/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h @@ -96,6 +96,7 @@ class SensoryKeywordDetector : public acsdkKWDImplementations::AbstractKeywordDe */ ~SensoryKeywordDetector() override; +#ifdef SENSORY_OP_POINT /** * Set the operating point of the SNSR engine. * @@ -105,6 +106,7 @@ class SensoryKeywordDetector : public acsdkKWDImplementations::AbstractKeywordDe static void setSnsrOperatingPoint(int value) { m_snsrOperatingPoint = value; }; +#endif // SENSORY_OP_POINT private: /** From 120462894c7ad9a3f1d9ce10ae489f21f43865f7 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 08:55:14 +0100 Subject: [PATCH 14/20] Fix use of static variable --- .../acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h b/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h index 2e00ea1e67..d29b38fd41 100644 --- a/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h +++ b/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h @@ -104,7 +104,7 @@ class SensoryKeywordDetector : public acsdkKWDImplementations::AbstractKeywordDe * @return void */ static void setSnsrOperatingPoint(int value) { - m_snsrOperatingPoint = value; + SensoryKeywordDetector::m_snsrOperatingPoint = value; }; #endif // SENSORY_OP_POINT From 6cc0ce25d776d03a2e5b25dd14f7ca2c04b8fd78 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 09:02:37 +0100 Subject: [PATCH 15/20] Fix use of static variable --- .../acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp b/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp index 74d481ed01..179680fa19 100644 --- a/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp +++ b/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp @@ -335,7 +335,7 @@ bool SensoryKeywordDetector::setUpRuntimeSettings(SnsrSession* session) { } #ifdef SENSORY_OP_POINT - result = snsrSetInt(*session, SNSR_OPERATING_POINT, m_snsrOperatingPoint); + result = snsrSetInt(*session, SNSR_OPERATING_POINT, SensoryKeywordDetector::m_snsrOperatingPoint); if (result != SNSR_RC_OK) { ACSDK_ERROR(LX("setUpRuntimeSettingsFailed") @@ -353,7 +353,7 @@ bool SensoryKeywordDetector::setUpRuntimeSettings(SnsrSession* session) { return false; } ACSDK_INFO(LX("setUpRuntimeSettings") - .d("operating point",op)); + .d("operating point", op)); #endif // SENSORY_OP_POINT return true; } From 951b3404a26493f282671b1652e530a253171dbe Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 09:25:42 +0100 Subject: [PATCH 16/20] Fix compiler flags --- .../acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h | 2 +- .../acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp | 2 +- tools/Install/pi.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h b/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h index d29b38fd41..2e00ea1e67 100644 --- a/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h +++ b/applications/acsdkSensoryAdapter/include/acsdkSensoryAdapter/Sensory/SensoryKeywordDetector.h @@ -104,7 +104,7 @@ class SensoryKeywordDetector : public acsdkKWDImplementations::AbstractKeywordDe * @return void */ static void setSnsrOperatingPoint(int value) { - SensoryKeywordDetector::m_snsrOperatingPoint = value; + m_snsrOperatingPoint = value; }; #endif // SENSORY_OP_POINT diff --git a/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp b/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp index 179680fa19..4d70ff468d 100644 --- a/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp +++ b/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp @@ -335,7 +335,7 @@ bool SensoryKeywordDetector::setUpRuntimeSettings(SnsrSession* session) { } #ifdef SENSORY_OP_POINT - result = snsrSetInt(*session, SNSR_OPERATING_POINT, SensoryKeywordDetector::m_snsrOperatingPoint); + result = snsrSetInt(*session, SNSR_OPERATING_POINT, m_snsrOperatingPoint); if (result != SNSR_RC_OK) { ACSDK_ERROR(LX("setUpRuntimeSettingsFailed") diff --git a/tools/Install/pi.sh b/tools/Install/pi.sh index 6277297973..a9afa5a371 100644 --- a/tools/Install/pi.sh +++ b/tools/Install/pi.sh @@ -39,8 +39,8 @@ case $KEY_WORD_DETECTOR_FLAG in S ) # Set CMAKE options for Sensory Keyword detector CMAKE_PLATFORM_SPECIFIC+=(-DSENSORY_KEY_WORD_DETECTOR=ON \ - -DSENSORY_OP_POINT_FLAG=ON \ - -DXMOS_AVS_TESTS_FLAG=ON \ + -DSENSORY_OP_POINT=ON \ + -DXMOS_AVS_TESTS=ON \ -DSENSORY_KEY_WORD_DETECTOR_LIB_PATH=$THIRD_PARTY_PATH/alexa-rpi/lib/libsnsr.a \ -DSENSORY_KEY_WORD_DETECTOR_INCLUDE_DIR=$THIRD_PARTY_PATH/alexa-rpi/include) ;; From 51f59267b16bccd4dfef4b93e2476c21cdd18a24 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 10:41:08 +0100 Subject: [PATCH 17/20] Initialize static variable --- .../acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp b/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp index 4d70ff468d..dee322d18f 100644 --- a/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp +++ b/applications/acsdkSensoryAdapter/src/SensoryKeywordDetector.cpp @@ -58,6 +58,10 @@ static const avsCommon::utils::AudioFormat::Encoding SENSORY_COMPATIBLE_ENCODING static const avsCommon::utils::AudioFormat::Endianness SENSORY_COMPATIBLE_ENDIANNESS = avsCommon::utils::AudioFormat::Endianness::LITTLE; +#ifdef SENSORY_OP_POINT +uint32_t SensoryKeywordDetector::m_snsrOperatingPoint = 0; +#endif // SENSORY_OP_POINT + /** * Checks to see if an @c avsCommon::utils::AudioFormat is compatible with Sensory. * From 5d5016d0805d625d6a2e9426ba17f8c843a7275c Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 10:44:23 +0100 Subject: [PATCH 18/20] Fix initialization of variable --- .../acsdkSensoryAdapter/acsdkKWD/src/KWDComponent.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/applications/acsdkSensoryAdapter/acsdkKWD/src/KWDComponent.cpp b/applications/acsdkSensoryAdapter/acsdkKWD/src/KWDComponent.cpp index b907912553..e9bdeecd1a 100644 --- a/applications/acsdkSensoryAdapter/acsdkKWD/src/KWDComponent.cpp +++ b/applications/acsdkSensoryAdapter/acsdkKWD/src/KWDComponent.cpp @@ -46,12 +46,15 @@ static std::shared_ptr createA std::shared_ptr keywordNotifier, std::shared_ptr keywordDetectorStateNotifier) { std::string modelFilePath; +#ifdef SENSORY_OP_POINT + uint32_t operatingPoint = 0; +#endif // SENSORY_OP_POINT + auto config = avsCommon::utils::configuration::ConfigurationNode::getRoot()[SAMPLE_APP_CONFIG_ROOT_KEY] [SENSORY_CONFIG_ROOT_KEY]; if (config) { config.getString(SENSORY_MODEL_FILE_PATH, &modelFilePath); #ifdef SENSORY_OP_POINT - uint32_t operatingPoint = 0; config.getUint32(SENSORY_SNSR_OPERATING_POINT, &operatingPoint); SensoryKeywordDetector::setSnsrOperatingPoint(operatingPoint); #endif // SENSORY_OP_POINT @@ -61,7 +64,7 @@ static std::shared_ptr createA return nullptr; } #ifdef SENSORY_OP_POINT - if (m_snsrOperatingPoint==0) { + if (operatingPoint==0) { ACSDK_ERROR(LX("createFailed").d("reason", "zeroSnsrOperatingPoint")); return nullptr; } From 460cc124a1600556969d9685770136e04ee4d356 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 11:51:12 +0100 Subject: [PATCH 19/20] Add comments --- tools/Install/setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/Install/setup.sh b/tools/Install/setup.sh index aea97acd5b..e9fca5b098 100755 --- a/tools/Install/setup.sh +++ b/tools/Install/setup.sh @@ -25,6 +25,8 @@ set -o nounset # Exit the script if any uninitialized variable is used. CLONE_URL=${CLONE_URL:- 'https://github.com/xmos/avs-device-sdk.git'} +# Download portaudio from github as it is more reliable than the website +# Comment out old variables # PORT_AUDIO_FILE="pa_stable_v190600_20161030.tgz" # PORT_AUDIO_DOWNLOAD_URL="https://github.com/PortAudio/portaudio/releases/tag/pa_stable_v190600_20161030" PORT_AUDIO_TAG="pa_stable_v190600_20161030" @@ -93,10 +95,11 @@ build_port_audio() { echo "==============> BUILDING PORT AUDIO ==============" echo pushd $THIRD_PARTY_PATH + # Download portaudio from github as it is more reliable than the website + # Comment out old lines # wget -c $PORT_AUDIO_DOWNLOAD_URL # tar zxf $PORT_AUDIO_FILE - # Download portaudio from github as it is more reliable than the website git clone -b $PORT_AUDIO_TAG $PORT_AUDIO_CLONE_URL pushd $PORT_AUDIO_DIR ./configure --without-jack From c0d2ed7364704a8831ec287f4107bf09fd3d6413 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 6 Jul 2022 11:55:10 +0100 Subject: [PATCH 20/20] Fix indentation --- tools/Install/pi.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install/pi.sh b/tools/Install/pi.sh index a9afa5a371..c5e509a712 100644 --- a/tools/Install/pi.sh +++ b/tools/Install/pi.sh @@ -49,10 +49,10 @@ case $KEY_WORD_DETECTOR_FLAG in CMAKE_PLATFORM_SPECIFIC+="" ;; G ) - CMAKE_PLATFORM_SPECIFIC+=(-DGPIO_KEY_WORD_DETECTOR=ON) + CMAKE_PLATFORM_SPECIFIC+=(-DGPIO_KEY_WORD_DETECTOR=ON) ;; H ) - CMAKE_PLATFORM_SPECIFIC+=(-DHID_KEY_WORD_DETECTOR=ON) + CMAKE_PLATFORM_SPECIFIC+=(-DHID_KEY_WORD_DETECTOR=ON) ;; esac