Snowman
0.1.0
|
Enrollment class. More...
#include <snowboy-detect.h>
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 |
Enrollment class.
Class that allows enrolling new personal hotwords.
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.
[in] | resource_filename | Filename of resource file. |
[in] | model_filename | Filename for the generated hotword model. |
int snowboy::SnowboyPersonalEnroll::BitsPerSample | ( | ) | const |
Returns the expected number of bits for audio provided to RunDetection().
int snowboy::SnowboyPersonalEnroll::GetNumTemplates | ( | ) | const |
Returns the minimum number of recordings required for the new hotword.
int snowboy::SnowboyPersonalEnroll::NumChannels | ( | ) | const |
Returns the expected number of channels for audio provided to RunDetection().
bool snowboy::SnowboyPersonalEnroll::Reset | ( | ) |
Resets the enrollment.
After reset the pipeline will behave identical to a freshly constructed instance.
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.
[in] | data | Recording of the hotword to be enrolled. |
[in] | array_length | Length of the data array in elements. |
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.
[in] | data | Recording of the hotword to be enrolled. |
[in] | array_length | Length of the data array in elements. |
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.
[in] | data | Recording of the hotword to be enrolled. |
[in] | array_length | Length of the data array in elements. |
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().
Code | Info |
---|---|
-1 | Error. |
0 | No event. |
1 | Hotword is too long |
2 | Hotword is too short |
[in] | data | Recording of the hotword to enroll. |
int snowboy::SnowboyPersonalEnroll::SampleRate | ( | ) | const |
Returns the expected sample rate for audio provided to RunDetection().