Snowman  0.1.0
Public Member Functions | Friends | List of all members
snowboy::SnowboyPersonalEnroll Class Reference

Enrollment class. More...

#include <snowboy-detect.h>

Inheritance diagram for snowboy::SnowboyPersonalEnroll:
Inheritance graph
[legend]

Public Member Functions

 SnowboyPersonalEnroll (const std::string &resource_filename, const std::string &model_filename)
 Default constructor. More...
 
int RunEnrollment (const std::string &data)
 Runs the hotword enrollment. More...
 
int RunEnrollment (const float *const data, const int array_length)
 Runs enrollment on float samples. More...
 
int RunEnrollment (const int16_t *const data, const int array_length)
 Runs enrollment on int16_t samples. More...
 
int RunEnrollment (const int32_t *const data, const int array_length)
 Runs enrollment on int32_t samples. More...
 
bool Reset ()
 Resets the enrollment. More...
 
int GetNumTemplates () const
 Returns the minimum number of recordings required for the new hotword. More...
 
int SampleRate () const
 Returns the expected sample rate for audio provided to RunDetection(). More...
 
int NumChannels () const
 Returns the expected number of channels for audio provided to RunDetection(). More...
 
int BitsPerSample () const
 Returns the expected number of bits for audio provided to RunDetection(). More...
 
 ~SnowboyPersonalEnroll ()
 Destructor.
 

Friends

class testing::Inspector
 

Detailed Description

Enrollment class.

Class that allows enrolling new personal hotwords.

Constructor & Destructor Documentation

◆ SnowboyPersonalEnroll()

snowboy::SnowboyPersonalEnroll::SnowboyPersonalEnroll ( const std::string &  resource_filename,
const std::string &  model_filename 
)

Default constructor.

Constructor that takes a resource file and a hotword model filename. The finished model will be written to the specified file.

Parameters
[in]resource_filenameFilename of resource file.
[in]model_filenameFilename for the generated hotword model.

Member Function Documentation

◆ BitsPerSample()

int snowboy::SnowboyPersonalEnroll::BitsPerSample ( ) const

Returns the expected number of bits for audio provided to RunDetection().

Returns
The expected number of bits.

◆ GetNumTemplates()

int snowboy::SnowboyPersonalEnroll::GetNumTemplates ( ) const

Returns the minimum number of recordings required for the new hotword.

Returns
Number of needed recordings.

◆ NumChannels()

int snowboy::SnowboyPersonalEnroll::NumChannels ( ) const

Returns the expected number of channels for audio provided to RunDetection().

Returns
The expected number of channels.

◆ Reset()

bool snowboy::SnowboyPersonalEnroll::Reset ( )

Resets the enrollment.

After reset the pipeline will behave identical to a freshly constructed instance.

Returns
true on success
false on error

◆ RunEnrollment() [1/4]

int snowboy::SnowboyPersonalEnroll::RunEnrollment ( const float *const  data,
const int  array_length 
)

Runs enrollment on float samples.

If NumChannels() > 1, e.g., NumChannels() == 2, then the array is as follows:

d1c1, d1c2, d2c1, d2c2, d3c1, d3c2, ..., dNc1, dNc2

where d1c1 means data point 1 of channel 1.

Parameters
[in]dataRecording of the hotword to be enrolled.
[in]array_lengthLength of the data array in elements.
Returns
See RunEnrollment(const std::string&) for details

◆ RunEnrollment() [2/4]

int snowboy::SnowboyPersonalEnroll::RunEnrollment ( const int16_t *const  data,
const int  array_length 
)

Runs enrollment on int16_t samples.

If NumChannels() > 1, e.g., NumChannels() == 2, then the array is as follows:

d1c1, d1c2, d2c1, d2c2, d3c1, d3c2, ..., dNc1, dNc2

where d1c1 means data point 1 of channel 1.

Parameters
[in]dataRecording of the hotword to be enrolled.
[in]array_lengthLength of the data array in elements.
Returns
See RunEnrollment(const std::string&) for details

◆ RunEnrollment() [3/4]

int snowboy::SnowboyPersonalEnroll::RunEnrollment ( const int32_t *const  data,
const int  array_length 
)

Runs enrollment on int32_t samples.

If NumChannels() > 1, e.g., NumChannels() == 2, then the array is as follows:

d1c1, d1c2, d2c1, d2c2, d3c1, d3c2, ..., dNc1, dNc2

where d1c1 means data point 1 of channel 1.

Parameters
[in]dataRecording of the hotword to be enrolled.
[in]array_lengthLength of the data array in elements.
Returns
See RunEnrollment(const std::string&) for details

◆ RunEnrollment() [4/4]

int snowboy::SnowboyPersonalEnroll::RunEnrollment ( const std::string &  data)

Runs the hotword enrollment.

Supported audio format is WAVE (with linear PCM, 8-bits unsigned integer, 16-bits signed integer or 32-bits signed integer). See SampleRate(), NumChannels() and BitsPerSample() for the required sampling rate, number of channels and bits per sample values. You are supposed to provide a full recording of the hotword each time you call RunEnrollment().

Returns

Code Info
-1 Error.
0 No event.
1 Hotword is too long
2 Hotword is too short
Parameters
[in]dataRecording of the hotword to enroll.

◆ SampleRate()

int snowboy::SnowboyPersonalEnroll::SampleRate ( ) const

Returns the expected sample rate for audio provided to RunDetection().

Returns
The expected samplerate.

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