public class VoiceTemplateFactory extends VoiceSdkNativePeer
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
VoiceTemplate
nativeId
Constructor and Description |
---|
VoiceTemplateFactory(java.lang.String initDataPath)
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
VoiceTemplate |
createVoiceTemplate(byte[] buffer,
int sampleRate) |
VoiceTemplate |
createVoiceTemplate(byte[] buffer,
int sampleRate,
ChannelType channelType)
Creates VoiceTemplate from byte-array PCM16 encoded audio.
|
VoiceTemplate |
createVoiceTemplate(float[] buffer,
int sampleRate) |
VoiceTemplate |
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 by
getMinimumAudioSampleRate() . |
VoiceTemplate |
createVoiceTemplate(short[] buffer,
int sampleRate) |
VoiceTemplate |
createVoiceTemplate(short[] buffer,
int sampleRate,
ChannelType channelType)
Creates VoiceTemplate from PCM16 encoded audio.
|
VoiceTemplate |
createVoiceTemplate(java.lang.String audioPath) |
VoiceTemplate |
createVoiceTemplate(java.lang.String audioPath,
ChannelType channelType)
Creates VoiceTemplate object from audio file.
|
protected VoiceTemplate |
createVoiceTemplate1(java.lang.String audioPath,
ChannelType channelType) |
protected VoiceTemplate |
createVoiceTemplate2(float[] buffer,
int sampleRate,
ChannelType channelType) |
protected VoiceTemplate |
createVoiceTemplate3(short[] buffer,
int sampleRate,
ChannelType channelType) |
protected VoiceTemplate |
createVoiceTemplate4(byte[] buffer,
int sampleRate,
ChannelType channelType) |
java.lang.String |
getInitDataId()
Returns ID of the init data, which was used to create the factory
|
int |
getMinimumAudioSampleRate()
Returns Returns minimum supported input audio sampling frequency in Hz
|
protected static long |
init(java.lang.String initDataPath) |
VoiceTemplate |
mergeVoiceTemplates(VoiceTemplate[] voiceTemplates)
Merges multiple VoiceTemplate objects into single
template . |
protected VoiceTemplate |
mergeVoiceTemplates1(VoiceTemplate[] voiceTemplates) |
protected void |
release()
This method should release resources on native layer (indirectly using nativeId)
|
close, equals, finalize, hashCode
public VoiceTemplateFactory(java.lang.String initDataPath)
initDataPath
- full path to the directory with SDK dataVoiceSdkEngineException
- wraps native exceptionspublic VoiceTemplate createVoiceTemplate(java.lang.String audioPath, ChannelType channelType)
getMinimumAudioSampleRate()
.audioPath
- path to audio filechannelType
- audio record source channelVoiceTemplate
VoiceSdkEngineException
- wraps native exceptionspublic VoiceTemplate createVoiceTemplate(java.lang.String audioPath)
public VoiceTemplate createVoiceTemplate(byte[] buffer, int sampleRate, ChannelType channelType)
getMinimumAudioSampleRate()
.buffer
- input array of byte samplessampleRate
- sample frequency, HzchannelType
- audio record source channelVoiceTemplate
VoiceSdkEngineException
- wraps native exceptionspublic VoiceTemplate createVoiceTemplate(byte[] buffer, int sampleRate)
public VoiceTemplate createVoiceTemplate(short[] buffer, int sampleRate, ChannelType channelType)
getMinimumAudioSampleRate()
.buffer
- input array of PCM16 samplessampleRate
- sample frequency, HzchannelType
- audio record source channelVoiceTemplate
VoiceSdkEngineException
- wraps native exceptionspublic VoiceTemplate createVoiceTemplate(short[] buffer, int sampleRate)
public VoiceTemplate createVoiceTemplate(float[] buffer, int sampleRate, ChannelType channelType)
getMinimumAudioSampleRate()
.buffer
- input array of float samples, values are limited by range [-1; 1]sampleRate
- sample frequency, HzchannelType
- audio record source channelVoiceTemplate
VoiceSdkEngineException
- wraps native exceptionspublic VoiceTemplate createVoiceTemplate(float[] buffer, int sampleRate)
public VoiceTemplate mergeVoiceTemplates(VoiceTemplate[] voiceTemplates)
template
.
All the templates should have the same init data ID as the factory instance.voiceTemplates
- input VoiceTemplate objectsVoiceTemplate
VoiceSdkEngineException
- wraps native exceptionspublic java.lang.String getInitDataId()
public int getMinimumAudioSampleRate()
protected static long init(java.lang.String initDataPath)
protected VoiceTemplate createVoiceTemplate1(java.lang.String audioPath, ChannelType channelType)
protected VoiceTemplate createVoiceTemplate2(float[] buffer, int sampleRate, ChannelType channelType)
protected VoiceTemplate createVoiceTemplate3(short[] buffer, int sampleRate, ChannelType channelType)
protected VoiceTemplate createVoiceTemplate4(byte[] buffer, int sampleRate, ChannelType channelType)
protected VoiceTemplate mergeVoiceTemplates1(VoiceTemplate[] voiceTemplates)
protected void release()
VoiceSdkNativePeer
release
in class VoiceSdkNativePeer