[Solved] Kitt_ai wakeword engine still not working on Matrix VOICE

Tried:

  1. GCC 4.8

  2. In /home/pi/avs-device-sdk/SampleApp/CMakeLists.txt add last line:
    “add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)” without quotes

  3. In /home/pi/avs-device-sdk/KWD/KittAi/src/KittAiKeyWordDetector.cpp,
    change:

m_maxSamplesPerPush{(audioFormat.sampleRateHz / HERTZ_PER_KILOHERTZ) * msToPushPerIteration.count()}
to:
m_maxSamplesPerPush{(audioFormat.sampleRateHz / HERTZ_PER_KILOHERTZ) * static_cast<unsigned int>(msToPushPerIteration.count())}

But nothing helped to prevent the same end result:

[ 93%] Linking CXX executable SampleApp
../../KWD/KittAi/src/libKITTAI.so: undefined reference to `snowboy::SnowboyDetect::SetSensitivity(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../../KWD/KittAi/src/libKITTAI.so: undefined reference to `snowboy::SnowboyDetect::SnowboyDetect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
SampleApp/src/CMakeFiles/SampleApp.dir/build.make:358: recipe for target 'SampleApp/src/SampleApp' failed
make[3]: *** [SampleApp/src/SampleApp] Error 1
CMakeFiles/Makefile2:8088: recipe for target 'SampleApp/src/CMakeFiles/SampleApp.dir/all' failed
make[2]: *** [SampleApp/src/CMakeFiles/SampleApp.dir/all] Error 2
CMakeFiles/Makefile2:8100: recipe for target 'SampleApp/src/CMakeFiles/SampleApp.dir/rule' failed
make[1]: *** [SampleApp/src/CMakeFiles/SampleApp.dir/rule] Error 2
Makefile:2084: recipe for target 'SampleApp' failed
make: *** [SampleApp] Error 2

@OPK Sorry for the late reply,

I haven’t finished with a full clean script for sensory/snowboy functions by I am close to do it. In the mean time check if you checkout the kitt_ai branch in the avs-device-sdk repo. Maybe was a error from the previous script.
You can also take a look to some changes I have made in that repo. If not just wait a bit for the final version :). You can be training you own wakeword in the snowboy website too !

-Yoel

Yep - I had correct script.
Result:

../../KWD/KittAi/src/libKITTAI.so: undefined reference to `snowboy::SnowboyDetect::SetSensitivity(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../../KWD/KittAi/src/libKITTAI.so: undefined reference to `snowboy::SnowboyDetect::SnowboyDetect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
SampleApp/src/CMakeFiles/SampleApp.dir/build.make:358: recipe for target 'SampleApp/src/SampleApp' failed
make[3]: *** [SampleApp/src/SampleApp] Error 1
CMakeFiles/Makefile2:8088: recipe for target 'SampleApp/src/CMakeFiles/SampleApp.dir/all' failed
make[2]: *** [SampleApp/src/CMakeFiles/SampleApp.dir/all] Error 2
CMakeFiles/Makefile2:8100: recipe for target 'SampleApp/src/CMakeFiles/SampleApp.dir/rule' failed
make[1]: *** [SampleApp/src/CMakeFiles/SampleApp.dir/rule] Error 2
Makefile:2084: recipe for target 'SampleApp' failed
make: *** [SampleApp] Error 2```

So this works on my 3B (some booting here & there):

firstly do a fresh Stretch install

curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get autoremove -y
echo "dtoverlay=matrixio" | sudo tee -a /boot/config.txt
echo "matrixio-everloop" | sudo tee -a /etc/modules
echo "audio_pwm_mode=1" | sudo tee -a /boot/config.txt
sudo apt install -y matrixio-creator-init
sudo apt install matrixio-kernel-modules
wget https://raw.githubusercontent.com/matrix-io/avs-device-sdk/yc/kitt_ai/tools/MatrixLabs/setup.sh
wget https://raw.githubusercontent.com/matrix-io/avs-device-sdk/ada5a8c0222e4af5a3310ffe49e306d6903b0be1/tools/MatrixLabs/config.txt
sudo bash setup.sh config.txt
sudo bash startauth.sh
open browser to finnish the authentication on local 3000
sudo bash startsample.sh

but I have not been able to change the wakeword or add sounds for recognising (or not) the wakeword…
Kitt_ai website talks about modifying “KittAiSnowboyWakeWordEngine.cpp”, but I dont seem to have it.

EDIT: this setup still uses Sensory… that is not my goal; so title valid: Kitt_ai still not working.

This shouldn’t be needed:

echo "dtoverlay=matrixio" | sudo tee -a /boot/config.txt
echo "matrixio-everloop" | sudo tee -a /etc/modules
echo "audio_pwm_mode=1" | sudo tee -a /boot/config.txt

Is great to hear it worked!

I will take a look at the adding sounds part.

-Yoel

Without
echo “audio_pwm_mode=1” | sudo tee -a /boot/config.txt
It doesnt work for me.

Any hints on how to change the wakeword?

@yoelrc88 Hi, any updates to get kitt_ai to work?

Yes, https://github.com/matrix-io/avs-device-sdk has been updated with latest 1.7SDk from amazon and Kitt_ai wakeword engine is added as an option.

Follow here: https://github.com/matrix-io/avs-device-sdk/blob/master/tools/MatrixLabs/README.md

Is setup by defaut to use Sensory but to change it to Kitt_ai modify /tools/MatrixLabs/setup.sh line 46 before running this script:

Let me know how it goes.

-Yoel

Hi @yoelrc88,
First of all thank you for your efforts, secondly have you ever tested this from scratch?
I did and besides another lost evening, the result was utter failure - again:
“CMakeFiles/Makefile2:3687: recipe for target ‘SampleApp/src/CMakeFiles/SampleApp.dir/rule’ failed
make[1]: *** [SampleApp/src/CMakeFiles/SampleApp.dir/rule] Error 2
Makefile:992: recipe for target ‘SampleApp’ failed
make: *** [SampleApp] Error 2”
If you start from a fresh Stretch image and follow the instructions to the letter, it fails.
I posted the full output in your fork, issue 1, build issues (https://github.com/matrix-io/matrixio-alexa-sdk-guide/issues)

Main error: [ 56%] Building CXX object CapabilityAgents/PlaybackController/src/CMakeFiles/PlaybackController.dir/PlaybackController.cpp.o
c++: internal compiler error: Killed (program cc1plus).

Please test from scratch - I assume you have upgraded/downgraded the gcc etc…

Yes, I tested it. Just maybe not from complete scratch, I will try to reproduce this error starting from an empty SdCard.

Thank for the feedback.

Please check the output I posted, this compiler error is strange (new stretch image). Just tested again. Same result - it hangs at 56%

I am on it :slight_smile: … using 2018-04-18 Raspbian Stretch.

Mine hung at the same point. Same percentage of build, but different file. Mine was hung at settings.cpp. I cancelled, and rebooted. 2nd time it said it ran out of Virtual Memory. Rebooted again and it compiled just fine.

I’m not using a fresh install of Stretch.

@OPK, You are right, it stops around 56% I think is related to using -j4 (using all processors) when building, Virtual Memory issue probably. I am double-checking everything but if this is the problem you have to options:

  • using -j2 as the official repo does (i just changed this at some point to make it faster :slight_smile: ).
  • increase the swapfile size, see here.

After the test I will be changing it to -j2 too in master.
-Yoel

@gapdev,

Thanks for testing too ! Did it finally work?

I was getting authorization errors and traced it back to not generating a new Client ID (can’t use the one from the device, have to generate a new one “Security Profiles - Other devices and platforms” ).

At least I’m hoping that is what the problem was.

I’m re-compiling now with the -j2 option instead of -j4.

The sampe config.txt file does not have a line for CLIENT_SECRET. I put mine in, assuming that it needs it.

Kenny

1 Like

Thanks for pointing that out @gapdev.

You can also try to build your own models and use it, just need few changes in the script.

-Yoel

1 Like

Hmm, maybe the Rpi overheated while using j4. Ive seen that before.
@yoelrc88 Question: when using a new wakeword model, do you need to run setup.sh again?
Btw I also put the Client_Secret in.

@gapdev any luck with the authorisation? I get errors also (with the new Other Devices and Platforms codes):

DeviceInfo:createFailed:reason=missingClientId,key=clientId

CBLAuthDelegate:requestToken
HttpPost:doPostSucceeded:code=400
CBLAuthDelegate:receiveTokenResponse:code=400,body={“error_description”:“The code pair has not been authorized”,“error”:“authorization_pending”}
CBLAuthDelegate:mapHTTPStatusToError:code=400,error=INVALID_REQUEST
CBLAuthDelegate:errorInLwaResponseBody:error=authorization_pending,errorCode=AUTHORIZATION_PENDING
CBLAuthDelegate:setAuthError:authError=AUTHORIZATION_PENDING
CBLAuthDelegate:receiveTokenResponseFailed:result=AUTHORIZATION_PENDING

That was the error I was having. I got the new Client ID from Security Profile, Other Devices, put it into config.txt, recompiled and got the same error. I then deleted everything and started from scratch with the new Client ID and it works.

Kenny