|
Snowman
0.1.0
|
Template cut class. More...
#include <snowboy-detect.h>

Public Member Functions | |
| SnowboyTemplateCut (const std::string &resource_filename) | |
| Default constructor. More... | |
| std::string | CutTemplate (const std::string &data) |
| Cuts the provided sample. More... | |
| int | CutTemplate (const float *const data, const int array_length, float *const data_out, int *array_length_out) |
| Runs enrollment on float samples. More... | |
| int | CutTemplate (const int16_t *const data, const int array_length, int16_t *const data_out, int *array_length_out) |
| Runs enrollment on int16_t samples. More... | |
| int | CutTemplate (const int32_t *const data, const int array_length, int32_t *const data_out, int *array_length_out) |
| Runs enrollment on int32_t samples. More... | |
| bool | Reset () |
| Resets the enrollment. 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... | |
| ~SnowboyTemplateCut () | |
| Destructor. | |
Friends | |
| class | testing::Inspector |
Template cut class.
Class that uses the voice activity detection to cut a hotword sample to size by removing all leading and trailing silence.
| snowboy::SnowboyTemplateCut::SnowboyTemplateCut | ( | const std::string & | resource_filename | ) |
Default constructor.
Constructor that takes a resource file.
| [in] | resource_filename | Filename of resource file. |
| int snowboy::SnowboyTemplateCut::BitsPerSample | ( | ) | const |
Returns the expected number of bits for audio provided to RunDetection().
| int snowboy::SnowboyTemplateCut::CutTemplate | ( | const float *const | data, |
| const int | array_length, | ||
| float *const | data_out, | ||
| int * | array_length_out | ||
| ) |
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 to be cut. |
| [in] | array_length | Size of data in number of elements. |
| [out] | data_out | Output buffer for the cut template. |
| [out] | array_length_out | Pointer to variable being filled with the size of the cut template in number of elements. |
| int snowboy::SnowboyTemplateCut::CutTemplate | ( | const int16_t *const | data, |
| const int | array_length, | ||
| int16_t *const | data_out, | ||
| int * | array_length_out | ||
| ) |
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 to be cut. |
| [in] | array_length | Size of data in number of elements. |
| [out] | data_out | Output buffer for the cut template. |
| [out] | array_length_out | Pointer to variable being filled with the size of the cut template in number of elements. |
| int snowboy::SnowboyTemplateCut::CutTemplate | ( | const int32_t *const | data, |
| const int | array_length, | ||
| int32_t *const | data_out, | ||
| int * | array_length_out | ||
| ) |
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 to be cut. |
| [in] | array_length | Size of data in number of elements. |
| [out] | data_out | Output buffer for the cut template. |
| [out] | array_length_out | Pointer to variable being filled with the size of the cut template in number of elements. |
| std::string snowboy::SnowboyTemplateCut::CutTemplate | ( | const std::string & | data | ) |
Cuts the provided sample.
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 on each call.
| [in] | data | Recording to be cut. |
| int snowboy::SnowboyTemplateCut::NumChannels | ( | ) | const |
Returns the expected number of channels for audio provided to RunDetection().
| bool snowboy::SnowboyTemplateCut::Reset | ( | ) |
Resets the enrollment.
After reset the pipeline will behave identical to a freshly constructed instance.
| int snowboy::SnowboyTemplateCut::SampleRate | ( | ) | const |
Returns the expected sample rate for audio provided to RunDetection().