Class for continuous voice verification using audio stream.
More...
#include <voicesdk/verify/verify_stream.h>
|
virtual void | reset ()=0 |
| Resets stream state.
|
|
virtual void | addSamples (const uint8_t *pcm16Bytes, size_t bytesNum)=0 |
| Adds byte representation of PCM16 audio samples to process. More...
|
|
virtual void | addSamples (const int16_t *pcm16Samples, size_t samplesNum)=0 |
| Adds PCM16 audio samples to process. More...
|
|
virtual void | addSamples (const float *floatSamples, size_t samplesNum)=0 |
| Adds float audio samples (in [-1; 1] range) to process. More...
|
|
virtual void | finalize ()=0 |
| Finalizes input audio stream to process remaining audio samples and produce result if it's possible.
|
|
virtual bool | hasVerifyResults () const =0 |
| Checks if there are available verification results in output queue. More...
|
|
virtual std::vector< VerifyStreamResult > | getVerifyResult ()=0 |
| Retrieves verification result from output queue containing one verify stream result for each reference template. Use hasVerifyResult() to know if there are available results. More...
|
|
virtual VerifyStreamResult | getVerifyResultForOneTemplate ()=0 |
| Retrieves verification result from output queue consisting of single verify stream result corresponding to the zeroth reference template. Suitable for the case when the only one reference template was specified. Use hasVerifyResult() to know if there are available results. More...
|
|
|
static Ptr | create (VoiceTemplateFactory::Ptr voiceTemplateFactory, VoiceTemplateMatcher::Ptr voiceTemplateMatcher, const std::vector< VoiceTemplate::Ptr > &voiceTemplates, size_t sampleRate, size_t audioContextLengthSeconds=10, float windowLengthSeconds=3.0f) |
| Factory method. More...
|
|
Class for continuous voice verification using audio stream.
◆ addSamples() [1/3]
virtual void voicesdk::VoiceVerifyStream::addSamples |
( |
const float * |
floatSamples, |
|
|
size_t |
samplesNum |
|
) |
| |
|
pure virtual |
Adds float audio samples (in [-1; 1] range) to process.
- Parameters
-
floatSamples | A buffer containing float audio samples |
samplesNum | Number of audio samples |
- Exceptions
-
- Note
- if exception was thrown, then stream state is being reset except the accumulated results buffer
◆ addSamples() [2/3]
virtual void voicesdk::VoiceVerifyStream::addSamples |
( |
const int16_t * |
pcm16Samples, |
|
|
size_t |
samplesNum |
|
) |
| |
|
pure virtual |
Adds PCM16 audio samples to process.
- Parameters
-
pcm16Samples | A buffer containing PCM16 audio samples |
samplesNum | Number of audio samples |
- Exceptions
-
- Note
- if exception was thrown, then stream state is being reset except the accumulated results buffer
◆ addSamples() [3/3]
virtual void voicesdk::VoiceVerifyStream::addSamples |
( |
const uint8_t * |
pcm16Bytes, |
|
|
size_t |
bytesNum |
|
) |
| |
|
pure virtual |
Adds byte representation of PCM16 audio samples to process.
- Parameters
-
pcm16Bytes | A buffer containing byte representation of PCM16 audio samples |
bytesNum | Number of bytes |
- Exceptions
-
- Note
- if exception was thrown, then stream state is being reset except the accumulated results buffer
◆ create()
static Ptr voicesdk::VoiceVerifyStream::create |
( |
VoiceTemplateFactory::Ptr |
voiceTemplateFactory, |
|
|
VoiceTemplateMatcher::Ptr |
voiceTemplateMatcher, |
|
|
const std::vector< VoiceTemplate::Ptr > & |
voiceTemplates, |
|
|
size_t |
sampleRate, |
|
|
size_t |
audioContextLengthSeconds = 10 , |
|
|
float |
windowLengthSeconds = 3.0f |
|
) |
| |
|
static |
Factory method.
- Parameters
-
voiceTemplateFactory | Voice template factory instance |
voiceTemplateMatcher | Voice template matcher instance |
voiceTemplates | Reference voice templates to match with |
sampleRate | Input audio stream sampling frequency in Hz |
audioContextLengthSeconds | Length of audio context for voice verification in seconds, must be at least windowLengthSeconds |
windowLengthSeconds | Length of audio window passed to the template creation during stream processing, must be at least 0.5 seconds |
- Returns
- Created VoiceVerifyStream instance
- Exceptions
-
- Note
- Sampling frequency should be equal to or greater than the value returned by VoiceTemplateFactory::getMinimumAudioSampleRate
-
Voice template matcher, voice template factory and voice template should have the same init data ID
◆ getVerifyResult()
Retrieves verification result from output queue containing one verify stream result for each reference template. Use hasVerifyResult() to know if there are available results.
- Returns
- VerifyStreamResult one verification result
- Exceptions
-
std::runtime_error | if runtime error occurred |
◆ getVerifyResultForOneTemplate()
Retrieves verification result from output queue consisting of single verify stream result corresponding to the zeroth reference template. Suitable for the case when the only one reference template was specified. Use hasVerifyResult() to know if there are available results.
- Returns
- VerifyStreamResult one verification result for the zeroth reference template
- Note
- Behaves the same as getVerifyResult in IDVoice CC < 1.10.0, if only one reference template was set
- Exceptions
-
std::runtime_error | if runtime error occurred |
◆ hasVerifyResults()
virtual bool voicesdk::VoiceVerifyStream::hasVerifyResults |
( |
| ) |
const |
|
pure virtual |
Checks if there are available verification results in output queue.
- Returns
- true is there are results available, else otherwise.