5 #include <voicesdk/core/config.h>
6 #include <voicesdk/core/common/voice_template.h>
11 #include <unordered_map>
32 friend std::ostream& operator<<(std::ostream& os,
const VerifyResult& obj) {
34 <<
"score: " << obj.
score <<
", "
39 bool operator==(
const VerifyResult& other)
const {
50 using Ptr = std::shared_ptr<VoiceTemplateMatcher>;
61 static Ptr
create(
const std::string& initPath);
155 using Ptr = std::shared_ptr<VoiceTemplateFactory>;
164 static Ptr
create(
const std::string& initPath);
177 const std::string& audioPath,
178 const ChannelType& channelType = ChannelType::TEL)
const = 0;
193 const float *floatSamples,
196 const ChannelType& channelType = ChannelType::TEL)
const = 0;
211 const int16_t *pcm16Samples,
214 const ChannelType& channelType = ChannelType::TEL)
const = 0;
229 const uint8_t *pcm16Bytes,
232 const ChannelType& channelType = ChannelType::TEL)
const = 0;
242 const std::vector<VerifyFileBatchElement>& input_batch)
const = 0;
283 virtual VoiceTemplate::Ptr
mergeVoiceTemplates(
const std::vector<VoiceTemplate::Ptr>& voiceTemplates)
const = 0;
Class for creating and merging voice templates.
Definition: verify.h:152
virtual VoiceTemplate::Ptr createVoiceTemplate(const float *floatSamples, size_t numSamples, size_t sampleRate, const ChannelType &channelType=ChannelType::TEL) const =0
Creates a voice template from the given float audio samples.
virtual VoiceTemplate::Ptr createVoiceTemplate(const uint8_t *pcm16Bytes, size_t numBytes, size_t sampleRate, const ChannelType &channelType=ChannelType::TEL) const =0
Creates a voice template from the given byte representation of PCM16 audio samples.
static Ptr create(const std::string &initPath)
Factory method.
virtual const size_t & getMinimumAudioSampleRate() const =0
Returns minimum supported input audio sampling frequency in Hz.
virtual std::vector< VoiceTemplate::Ptr > createVoiceTemplateBatch(const std::vector< VerifySamplesBatchElement< float >> &input_batch) const =0
Creates a voice template from the given batch of float audio samples.
virtual std::vector< VoiceTemplate::Ptr > createVoiceTemplateBatch(const std::vector< VerifyFileBatchElement > &input_batch) const =0
Creates a voice template from the given batch of WAV files.
virtual std::vector< VoiceTemplate::Ptr > createVoiceTemplateBatch(const std::vector< VerifySamplesBatchElement< uint8_t >> &input_batch) const =0
Creates a voice template from the given batch of byte representation PCM16 audio samples.
virtual VoiceTemplate::Ptr mergeVoiceTemplates(const std::vector< VoiceTemplate::Ptr > &voiceTemplates) const =0
Merges multiple voice templates of a single speaker to a union voice template.
virtual VoiceTemplate::Ptr createVoiceTemplate(const int16_t *pcm16Samples, size_t numSamples, size_t sampleRate, const ChannelType &channelType=ChannelType::TEL) const =0
Creates a voice template from the given PCM16 audio samples.
virtual const std::string & getInitDataId() const =0
Returns ID of the init data, which was used to create the factory.
virtual VoiceTemplate::Ptr createVoiceTemplate(const std::string &audioPath, const ChannelType &channelType=ChannelType::TEL) const =0
Creates a voice template from the given audio file.
virtual std::vector< VoiceTemplate::Ptr > createVoiceTemplateBatch(const std::vector< VerifySamplesBatchElement< int16_t >> &input_batch) const =0
Creates a voice template from the given batch of PCM16 audio samples.
Class for matching voice templates one-to-one.
Definition: verify.h:48
virtual const std::string & getInitDataId() const =0
Returns ID of the init data, which was used to create the matcher.
static Ptr create(const std::string &initPath)
Factory method.
virtual VerifyResult matchVoiceTemplates(const VoiceTemplate::Ptr &template1, const VoiceTemplate::Ptr &template2) const =0
Matches two voice templates one-to-one.
Struct for custom quality checking thresholds VoiceTemplateFactory::checkQuality.
Definition: verify.h:85
float minimumSnrDb
Minimum signal-to-noise ratio required to pass quality check in dB.
Definition: verify.h:89
float minimumSpeechLengthMs
Minimum speech length required to pass quality check in milliseconds.
Definition: verify.h:94
Struct for verify factory batch processing VoiceTemplateFactory::createVoiceTemplateBatch.
Definition: verify.h:101
std::string wav_file_path
path to WAV file
Definition: verify.h:108
ChannelType channel_type
Audio record channel type.
Definition: verify.h:113
Structure representing voice verification result.
Definition: verify.h:17
float probability
Voice matching probability from 0 to 1, should be used for making a biometrics authentication decisio...
Definition: verify.h:28
float score
Raw verification score, intended to be used for evaluation and data-wise calibration.
Definition: verify.h:22
Struct for verify factory batch processing VoiceTemplateFactory::createVoiceTemplateBatch.
Definition: verify.h:121
size_t data_size
Number of audio samples.
Definition: verify.h:133
const T * data
A buffer containing audio samples.
Definition: verify.h:128
ChannelType channel_type
Audio record channel type.
Definition: verify.h:145
size_t sample_rate
Audio sampling rate in Hz.
Definition: verify.h:140