AlexaClientSDK  1.24.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::kwd::KittAiKeyWordDetector Class Reference

#include <KittAiKeyWordDetector.h>

Inheritance diagram for alexaClientSDK::kwd::KittAiKeyWordDetector:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::kwd::KittAiKeyWordDetector:
Collaboration graph
[legend]

Classes

struct  KittAiConfiguration
 

Public Member Functions

 ~KittAiKeyWordDetector () override
 
- Public Member Functions inherited from alexaClientSDK::kwd::AbstractKeywordDetector
void addKeyWordObserver (std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface > keyWordObserver)
 
void removeKeyWordObserver (std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface > keyWordObserver)
 
void addKeyWordDetectorStateObserver (std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface > keyWordDetectorStateObserver)
 
void removeKeyWordDetectorStateObserver (std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface > keyWordDetectorStateObserver)
 
virtual ~AbstractKeywordDetector ()=default
 

Static Public Member Functions

static std::unique_ptr< KittAiKeyWordDetectorcreate (std::shared_ptr< avsCommon::avs::AudioInputStream > stream, avsCommon::utils::AudioFormat audioFormat, std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface >> keyWordObservers, std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >> keyWordDetectorStateObservers, const std::string &resourceFilePath, const std::vector< KittAiConfiguration > kittAiConfigurations, float audioGain, bool applyFrontEnd, std::chrono::milliseconds msToPushPerIteration=std::chrono::milliseconds(20))
 

Additional Inherited Members

- Protected Member Functions inherited from alexaClientSDK::kwd::AbstractKeywordDetector
 AbstractKeywordDetector (std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface >> keyWordObservers=std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface >>(), std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >> keyWordDetectorStateObservers=std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >>())
 
void notifyKeyWordObservers (std::shared_ptr< avsCommon::avs::AudioInputStream > stream, std::string keyword, avsCommon::avs::AudioInputStream::Index beginIndex, avsCommon::avs::AudioInputStream::Index endIndex, std::shared_ptr< const std::vector< char >> KWDMetadata=nullptr) const
 
void notifyKeyWordDetectorStateObservers (avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface::KeyWordDetectorState state)
 
ssize_t readFromStream (std::shared_ptr< avsCommon::avs::AudioInputStream::Reader > reader, std::shared_ptr< avsCommon::avs::AudioInputStream > stream, void *buf, size_t nWords, std::chrono::milliseconds timeout, bool *errorOccurred)
 
- Static Protected Member Functions inherited from alexaClientSDK::kwd::AbstractKeywordDetector
static bool isByteswappingRequired (avsCommon::utils::AudioFormat audioFormat)
 

Constructor & Destructor Documentation

◆ ~KittAiKeyWordDetector()

alexaClientSDK::kwd::KittAiKeyWordDetector::~KittAiKeyWordDetector ( )
override

Destructor.

Member Function Documentation

◆ create()

std::unique_ptr< KittAiKeyWordDetector > alexaClientSDK::kwd::KittAiKeyWordDetector::create ( std::shared_ptr< avsCommon::avs::AudioInputStream stream,
avsCommon::utils::AudioFormat  audioFormat,
std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface >>  keyWordObservers,
std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >>  keyWordDetectorStateObservers,
const std::string &  resourceFilePath,
const std::vector< KittAiConfiguration kittAiConfigurations,
float  audioGain,
bool  applyFrontEnd,
std::chrono::milliseconds  msToPushPerIteration = std::chrono::milliseconds(20) 
)
static

Creates a KittAiKeyWordDetector.

Parameters
streamThe 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.
audioFormatThe format of the audio data located within the stream.
keyWordObserversThe observers to notify of keyword detections.
keyWordDetectorStateObserversThe observers to notify of state changes in the engine.
resourceFilePathThe path to the resource file.
kittAiConfigurationsA vector of KittAiConfiguration objects that will be used to initialize the engine and keywords.
audioGainThis controls whether to increase (>1) or decrease (<1) input volume.
applyFrontEndWhether to apply frontend audio processing.
msToPushPerIterationThe amount of data in milliseconds to push to Kitt.ai at a time. Smaller sizes will lead to less delay but more CPU usage. Additionally, larger amounts of data fed into the engine per iteration might lead longer delays before receiving keyword detection events. This has been defaulted to 20 milliseconds as it is a good trade off between CPU usage and recognition delay.
Returns
A new KittAiKeyWordDetector, or nullptr if the operation failed.
See also
https://github.com/Kitt-AI/snowboy for more information regarding audioGain and applyFrontEnd.

The documentation for this class was generated from the following files:

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