Call Center SDK  1.11.3
Public Types | Public Member Functions | Static Public Member Functions | List of all members
voicesdk::VoiceTemplateFactory Class Referenceabstract

Class for creating and merging voice templates. More...

#include <voicesdk/verify/verify.h>

Public Types

using Ptr = std::shared_ptr< VoiceTemplateFactory >
 

Public Member Functions

virtual VoiceTemplate::Ptr createVoiceTemplate (const std::string &audioPath, const ChannelType &channelType=ChannelType::TEL) const =0
 Creates a voice template from the given audio file. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual const std::string & getInitDataId () const =0
 Returns ID of the init data, which was used to create the factory. More...
 
virtual const size_t & getMinimumAudioSampleRate () const =0
 Returns minimum supported input audio sampling frequency in Hz. More...
 

Static Public Member Functions

static Ptr create (const std::string &initPath)
 Factory method. More...
 

Detailed Description

Class for creating and merging voice templates.

Member Function Documentation

◆ create()

static Ptr voicesdk::VoiceTemplateFactory::create ( const std::string &  initPath)
static

Factory method.

Parameters
initPathPath to the init data folder
Returns
Created VoiceTemplateFactory instance
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred

◆ createVoiceTemplate() [1/4]

virtual VoiceTemplate::Ptr voicesdk::VoiceTemplateFactory::createVoiceTemplate ( const float *  floatSamples,
size_t  numSamples,
size_t  sampleRate,
const ChannelType &  channelType = ChannelType::TEL 
) const
pure virtual

Creates a voice template from the given float audio samples.

Parameters
floatSamplesA buffer containing normalized (from -1 to 1) float audio samples
numSamplesNumber of audio samples
sampleRateAudio sampling rate in Hz
channelTypeAudio record channel type
Returns
Created voice template
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred
Note
Sampling frequency should be equal to or greater than the value returned by VoiceTemplateFactory::getMinimumAudioSampleRate

◆ createVoiceTemplate() [2/4]

virtual VoiceTemplate::Ptr voicesdk::VoiceTemplateFactory::createVoiceTemplate ( const int16_t *  pcm16Samples,
size_t  numSamples,
size_t  sampleRate,
const ChannelType &  channelType = ChannelType::TEL 
) const
pure virtual

Creates a voice template from the given PCM16 audio samples.

Parameters
pcm16SamplesA buffer containing PCM16 audio samples
numSamplesNumber of audio samples
sampleRateAudio sampling rate in Hz
channelTypeAudio record channel type
Returns
Created voice template
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred
Note
Sampling frequency should be equal to or greater than the value returned by VoiceTemplateFactory::getMinimumAudioSampleRate

◆ createVoiceTemplate() [3/4]

virtual VoiceTemplate::Ptr voicesdk::VoiceTemplateFactory::createVoiceTemplate ( const std::string &  audioPath,
const ChannelType &  channelType = ChannelType::TEL 
) const
pure virtual

Creates a voice template from the given audio file.

Parameters
audioPathPath to audio file
channelTypeAudio record channel type
Returns
Created voice template
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred
Note
Sampling frequency should be equal to or greater than the value returned by VoiceTemplateFactory::getMinimumAudioSampleRate

◆ createVoiceTemplate() [4/4]

virtual VoiceTemplate::Ptr voicesdk::VoiceTemplateFactory::createVoiceTemplate ( const uint8_t *  pcm16Bytes,
size_t  numBytes,
size_t  sampleRate,
const ChannelType &  channelType = ChannelType::TEL 
) const
pure virtual

Creates a voice template from the given byte representation of PCM16 audio samples.

Parameters
pcm16BytesA buffer containing byte representation of PCM16 audio samples
numBytesNumber of bytes
sampleRateAudio sampling rate in Hz
channelTypeAudio record channel type
Returns
Created voice template
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred
Note
Sampling frequency should be equal to or greater than the value returned by VoiceTemplateFactory::getMinimumAudioSampleRate

◆ createVoiceTemplateBatch() [1/4]

virtual std::vector<VoiceTemplate::Ptr> voicesdk::VoiceTemplateFactory::createVoiceTemplateBatch ( const std::vector< VerifyFileBatchElement > &  input_batch) const
pure virtual

Creates a voice template from the given batch of WAV files.

Parameters
input_batchA vector of VerifyFileBatchElement
Returns
Created voice templates vector
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred

◆ createVoiceTemplateBatch() [2/4]

virtual std::vector<VoiceTemplate::Ptr> voicesdk::VoiceTemplateFactory::createVoiceTemplateBatch ( const std::vector< VerifySamplesBatchElement< float >> &  input_batch) const
pure virtual

Creates a voice template from the given batch of float audio samples.

Parameters
input_batchA vector of VerifySamplesBatchElement<float>
Returns
Created voice templates vector
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred
Note
float audio samples should be normalized (from -1 to 1)

◆ createVoiceTemplateBatch() [3/4]

virtual std::vector<VoiceTemplate::Ptr> voicesdk::VoiceTemplateFactory::createVoiceTemplateBatch ( const std::vector< VerifySamplesBatchElement< int16_t >> &  input_batch) const
pure virtual

Creates a voice template from the given batch of PCM16 audio samples.

Parameters
input_batchA vector of VerifySamplesBatchElement<int16_t>
Returns
Created voice templates vector
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred

◆ createVoiceTemplateBatch() [4/4]

virtual std::vector<VoiceTemplate::Ptr> voicesdk::VoiceTemplateFactory::createVoiceTemplateBatch ( const std::vector< VerifySamplesBatchElement< uint8_t >> &  input_batch) const
pure virtual

Creates a voice template from the given batch of byte representation PCM16 audio samples.

Parameters
input_batchA vector of VerifySamplesBatchElement<uint8_t>
Returns
Created voice templates vector
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred

◆ getInitDataId()

virtual const std::string& voicesdk::VoiceTemplateFactory::getInitDataId ( ) const
pure virtual

Returns ID of the init data, which was used to create the factory.

Returns
A string containing init data ID

◆ getMinimumAudioSampleRate()

virtual const size_t& voicesdk::VoiceTemplateFactory::getMinimumAudioSampleRate ( ) const
pure virtual

Returns minimum supported input audio sampling frequency in Hz.

Returns
A minimum sampling rate in Hz

◆ mergeVoiceTemplates()

virtual VoiceTemplate::Ptr voicesdk::VoiceTemplateFactory::mergeVoiceTemplates ( const std::vector< VoiceTemplate::Ptr > &  voiceTemplates) const
pure virtual

Merges multiple voice templates of a single speaker to a union voice template.

Parameters
voiceTemplatesvector of speaker's voice templates
Returns
A union voice template
Exceptions
std::runtime_errorif runtime error occurred
voicesdk::LicenseExceptionif license error occurred
Note
All the templates should have the same init data ID as the factory instance