AlexaClientSDK  1.24.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Functions | Variables
KittAiKeyWordDetectorTest.cpp File Reference
#include <chrono>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <gtest/gtest.h>
#include <AVSCommon/SDKInterfaces/KeyWordObserverInterface.h>
#include <AVSCommon/SDKInterfaces/KeyWordDetectorStateObserverInterface.h>
#include <AVSCommon/AVS/AudioInputStream.h>
#include <AVSCommon/Utils/SDS/SharedDataStream.h>
#include "KittAi/KittAiKeyWordDetector.h"
Include dependency graph for KittAiKeyWordDetectorTest.cpp:

Classes

class  alexaClientSDK::kwd::test::testKeyWordObserver
 A test observer that mocks out the KeyWordObserverInterface#onKeyWordDetected() call. More...
 
struct  alexaClientSDK::kwd::test::testKeyWordObserver::detectionResult
 A struct used for bookkeeping of keyword detections. More...
 
class  alexaClientSDK::kwd::test::testStateObserver
 A test observer that mocks out the KeyWordDetectorStateObserverInterface#onStateChanged() call. More...
 
class  alexaClientSDK::kwd::test::KittAiKeyWordTest
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::kwd
 
 alexaClientSDK::kwd::test
 

Functions

 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_invalidStream)
 Tests that we don't get back a valid detector if an invalid stream is passed in. More...
 
 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_incompatibleEndianness)
 Tests that we don't get back a valid detector if an invalid endianness is passed in. More...
 
 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_getExpectedNumberOfDetectionsInFourAlexasAudioFileForOneObserver)
 Tests that we get back the expected number of keywords for the four_alexa.wav file for one keyword observer. More...
 
 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_getExpectedNumberOfDetectionsInFourAlexasAudioFileForTwoObservers)
 Tests that we get back the expected number of keywords for the four_alexa.wav file for two keyword observers. More...
 
 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_getExpectedNumberOfDetectionsInAlexaStopAlexaJokeAudioFileForOneObserver)
 
 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_getExpectedNumberOfDetectionsInAlexaStopAlexaJokeAudioFileForTwoObservers)
 
 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_getActiveState)
 Tests that the detector state changes to ACTIVE when the detector is initialized properly. More...
 
 alexaClientSDK::kwd::test::TEST_F (KittAiKeyWordTest, test_getStreamClosedState)
 
int main (int argc, char **argv)
 

Variables

std::string alexaClientSDK::kwd::test::inputsDirPath
 The path to the inputs folder that should be passed in via command line argument. More...
 
static const std::string alexaClientSDK::kwd::test::RESOURCE_FILE = "/KittAiModels/common.res"
 The name of the resource file required for Kitt.ai. More...
 
static const std::string alexaClientSDK::kwd::test::MODEL_FILE = "/KittAiModels/alexa.umdl"
 The name of the Alexa model file for Kitt.ai. More...
 
static const std::string alexaClientSDK::kwd::test::MODEL_KEYWORD = "ALEXA"
 The keyword associated with alexa.umdl. More...
 
static const std::string alexaClientSDK::kwd::test::FOUR_ALEXAS_AUDIO_FILE = "/four_alexa.wav"
 The name of a test audio file. More...
 
static const std::string alexaClientSDK::kwd::test::ALEXA_STOP_ALEXA_JOKE_AUDIO_FILE = "/alexa_stop_alexa_joke.wav"
 The name of a test audio file. More...
 
static const int alexaClientSDK::kwd::test::SAMPLES_PER_MS = 16
 The number of samples per millisecond, assuming a sample rate of 16 kHz. More...
 
static const std::chrono::milliseconds alexaClientSDK::kwd::test::MARGIN = std::chrono::milliseconds(100)
 The margin in milliseconds for testing indices of keyword detections. More...
 
static const AudioInputStream::Index alexaClientSDK::kwd::test::MARGIN_IN_SAMPLES = MARGIN.count() * SAMPLES_PER_MS
 The margin in samples for testing indices of keyword detections. More...
 
static const size_t alexaClientSDK::kwd::test::NUM_ALEXAS_IN_FOUR_ALEXAS_AUDIO_FILE = 4
 The number of "Alexa" keywords in the four_alexa.wav file. More...
 
std::vector< AudioInputStream::Index > alexaClientSDK::kwd::test::END_INDICES_OF_ALEXAS_IN_FOUR_ALEXAS_AUDIO_FILE = {21440, 52800, 72480, 91552}
 The approximate end indices of the four "Alexa" hotwords in the four_alexa.wav file. More...
 
static const size_t alexaClientSDK::kwd::test::NUM_ALEXAS_IN_ALEXA_STOP_ALEXA_JOKE_AUDIO_FILE = 2
 The number of "Alexa" keywords in the alexa_stop_alexa_joke.wav file. More...
 
std::vector< AudioInputStream::Index > alexaClientSDK::kwd::test::END_INDICES_OF_ALEXAS_IN_ALEXA_STOP_ALEXA_JOKE_AUDIO_FILE = {20960, 51312}
 The approximate end indices of the two "Alexa" hotwords in the alexa_stop_alexa_joke.wav file. More...
 
static const avsCommon::utils::AudioFormat::Encoding alexaClientSDK::kwd::test::COMPATIBLE_ENCODING
 The compatible encoding for Kitt.ai. More...
 
static const avsCommon::utils::AudioFormat::Endianness alexaClientSDK::kwd::test::COMPATIBLE_ENDIANNESS
 The compatible endianness for Kitt.ai. More...
 
static const unsigned int alexaClientSDK::kwd::test::COMPATIBLE_SAMPLE_RATE = 16000
 The compatible sample rate for Kitt.ai. More...
 
static const unsigned int alexaClientSDK::kwd::test::COMPATIBLE_SAMPLE_SIZE_IN_BITS = 16
 The compatible bits per sample for Kitt.ai. More...
 
static const unsigned int alexaClientSDK::kwd::test::COMPATIBLE_NUM_CHANNELS = 1
 The compatible number of channels for Kitt.ai. More...
 
static const auto alexaClientSDK::kwd::test::DEFAULT_TIMEOUT = std::chrono::milliseconds(4000)
 Timeout for expected callbacks. More...
 
static const double alexaClientSDK::kwd::test::KITTAI_AUDIO_GAIN = 2.0
 The audio gain to apply to the detectors so that the expected detections occur. More...
 
static const bool alexaClientSDK::kwd::test::KITTAI_APPLY_FRONTEND_PROCESSING = false
 Whether to tell Kitt.ai to apply front end processing. This is false since this only works on Raspberry Pi. More...
 
static const double alexaClientSDK::kwd::test::KITTAI_SENSITIVITY = 0.6
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

AlexaClientSDK 1.24.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0