Package net.idrnd.voicesdk.verify
Class VoiceTemplateFactory
java.lang.Object
net.idrnd.voicesdk.common.VoiceSdkNativePeer
net.idrnd.voicesdk.verify.VoiceTemplateFactory
- All Implemented Interfaces:
AutoCloseable
Provides capabilities for creating and comparing
VoiceTemplate.
This class serves as gateway to native Voice SDK implementation and allocates resources on native heap.
To release the allocated memory, AutoCloseable.close() method should be invoked when the instance is no longer needed.
Any method that delegates to native call may throw VoiceSdkEngineException
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateVoiceTemplate(byte[] buffer, int sampleRate) createVoiceTemplate(byte[] buffer, int sampleRate, ChannelType channelType) Creates VoiceTemplate from byte-array PCM16 encoded audio.createVoiceTemplate(float[] buffer, int sampleRate) createVoiceTemplate(float[] buffer, int sampleRate, ChannelType channelType) Creates VoiceTemplate from audio data encoded in 'truncated' float format Sampling frequency should be equal to or greater than the value returned bygetMinimumAudioSampleRate().createVoiceTemplate(short[] buffer, int sampleRate) createVoiceTemplate(short[] buffer, int sampleRate, ChannelType channelType) Creates VoiceTemplate from PCM16 encoded audio.createVoiceTemplate(String audioPath) createVoiceTemplate(String audioPath, ChannelType channelType) Creates VoiceTemplate object from audio file.Returns ID of the init data, which was used to create the factoryintReturns Returns minimum supported input audio sampling frequency in HzmergeVoiceTemplates(VoiceTemplate[] voiceTemplates) Merges multiple VoiceTemplate objects into singletemplate.Methods inherited from class net.idrnd.voicesdk.common.VoiceSdkNativePeer
close, equals, hashCode
-
Constructor Details
-
VoiceTemplateFactory
Sole constructor. Initializes the Engine object and allocates the native resources.- Parameters:
initDataPath- full path to the directory with SDK data- Throws:
VoiceSdkEngineException- wraps native exceptions
-
-
Method Details
-
createVoiceTemplate
Creates VoiceTemplate object from audio file. Sampling frequency should be equal to or greater than the value returned bygetMinimumAudioSampleRate().- Parameters:
audioPath- path to audio filechannelType- audio record source channel- Returns:
VoiceTemplate- Throws:
VoiceSdkEngineException- wraps native exceptions
-
createVoiceTemplate
-
createVoiceTemplate
Creates VoiceTemplate from byte-array PCM16 encoded audio. Sampling frequency should be equal to or greater than the value returned bygetMinimumAudioSampleRate().- Parameters:
buffer- input array of byte samplessampleRate- sample frequency, HzchannelType- audio record source channel- Returns:
VoiceTemplate- Throws:
VoiceSdkEngineException- wraps native exceptions
-
createVoiceTemplate
-
createVoiceTemplate
Creates VoiceTemplate from PCM16 encoded audio. Sampling frequency should be equal to or greater than the value returned bygetMinimumAudioSampleRate().- Parameters:
buffer- input array of PCM16 samplessampleRate- sample frequency, HzchannelType- audio record source channel- Returns:
VoiceTemplate- Throws:
VoiceSdkEngineException- wraps native exceptions
-
createVoiceTemplate
-
createVoiceTemplate
Creates VoiceTemplate from audio data encoded in 'truncated' float format Sampling frequency should be equal to or greater than the value returned bygetMinimumAudioSampleRate().- Parameters:
buffer- input array of float samples, values are limited by range [-1; 1]sampleRate- sample frequency, HzchannelType- audio record source channel- Returns:
VoiceTemplate- Throws:
VoiceSdkEngineException- wraps native exceptions
-
createVoiceTemplate
-
mergeVoiceTemplates
Merges multiple VoiceTemplate objects into singletemplate. All the templates should have the same init data ID as the factory instance.- Parameters:
voiceTemplates- input VoiceTemplate objects- Returns:
VoiceTemplate- Throws:
VoiceSdkEngineException- wraps native exceptions
-
getInitDataId
Returns ID of the init data, which was used to create the factory- Returns:
- A string containing init data ID
-
getMinimumAudioSampleRate
public int getMinimumAudioSampleRate()Returns Returns minimum supported input audio sampling frequency in Hz- Returns:
- A minimum sampling rate in Hz
-