Package net.idrnd.voicesdk.liveness
Class LivenessEngine
java.lang.Object
net.idrnd.voicesdk.common.VoiceSdkNativePeer
net.idrnd.voicesdk.liveness.LivenessEngine
- All Implemented Interfaces:
AutoCloseable
Performs voice liveness check.
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
-
Constructor Summary
ConstructorsConstructorDescriptionLivenessEngine(String initPath) Creates the instance and allocates native memory. -
Method Summary
Modifier and TypeMethodDescriptioncheckLiveness(byte[] pcm16Bytes, int sampleRate) Checks voice liveness from the given audio bytes.checkLiveness(float[] floatSamples, int sampleRate) Checks voice liveness from the given float audio samples.checkLiveness(short[] pcm16Samples, int sampleRate) Checks voice liveness from the given PCM16 audio samples.checkLiveness(String audioFile) Checks voice liveness from the given audio file.Methods inherited from class net.idrnd.voicesdk.common.VoiceSdkNativePeer
close, equals, hashCode
-
Constructor Details
-
LivenessEngine
Creates the instance and allocates native memory.- Parameters:
initPath- full path to the directory with init data- Throws:
VoiceSdkEngineException- wraps native exceptions
-
-
Method Details
-
checkLiveness
Checks voice liveness from the given audio bytes.- Parameters:
pcm16Bytes- Array of little-endian PCM16 audio bytessampleRate- Sample rate of the audio, Hz- Returns:
LivenessResult- Throws:
VoiceSdkEngineException- wraps native exceptions
-
checkLiveness
Checks voice liveness from the given PCM16 audio samples.- Parameters:
pcm16Samples- Array of PCM16 audio samplessampleRate- Sample rate of the audio, Hz- Returns:
LivenessResult- Throws:
VoiceSdkEngineException- wraps native exceptions
-
checkLiveness
Checks voice liveness from the given float audio samples.- Parameters:
floatSamples- Array of float audio samples (in [-1, 1] range)sampleRate- Sample rate of the audio, Hz- Returns:
LivenessResult- Throws:
VoiceSdkEngineException- wraps native exceptions
-
checkLiveness
Checks voice liveness from the given audio file.- Parameters:
audioFile- Path to the audio file- Returns:
LivenessResult- Throws:
VoiceSdkEngineException- wraps native exceptions
-