public class AntispoofEngine extends VoiceSdkNativePeer
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
nativeId
Constructor and Description |
---|
AntispoofEngine(java.lang.String initPath)
Creates the instance and allocates native memory.
|
Modifier and Type | Method and Description |
---|---|
protected static long |
init(java.lang.String initPath) |
AntispoofResult |
isSpoof(byte[] pcm16Bytes,
int sampleRate)
Detects spoofing in audio provided in PCM16 format.
|
AntispoofResult |
isSpoof(float[] floatSamples,
int sampleRate)
Detects spoofing in audio provided in normalized float format.
|
AntispoofResult |
isSpoof(short[] pcm16Samples,
int sampleRate)
Detects spoofing in audio provided in PCM16 format.
|
AntispoofResult |
isSpoof(java.lang.String audioFile)
Detects spoofing in audio file.
|
protected AntispoofResult |
isSpoof1(byte[] pcm16Bytes,
int sampleRate) |
protected AntispoofResult |
isSpoof2(short[] pcm16Samples,
int sampleRate) |
protected AntispoofResult |
isSpoof3(float[] floatSamples,
int sampleRate) |
protected AntispoofResult |
isSpoof4(java.lang.String audioFile) |
protected void |
release()
This method should release resources on native layer (indirectly using nativeId)
|
close, equals, finalize, hashCode
public AntispoofEngine(java.lang.String initPath)
initPath
- full path to the directory with init dataVoiceSdkEngineException
- wraps native exceptionspublic AntispoofResult isSpoof(byte[] pcm16Bytes, int sampleRate)
pcm16Bytes
- Array of little-endian PCM16 audio bytessampleRate
- Sample rate of the audio, HzAntispoofResult
VoiceSdkEngineException
- wraps native exceptionspublic AntispoofResult isSpoof(short[] pcm16Samples, int sampleRate)
pcm16Samples
- Array of PCM16 audio samplessampleRate
- Sample rate of the audio, HzAntispoofResult
VoiceSdkEngineException
- wraps native exceptionspublic AntispoofResult isSpoof(float[] floatSamples, int sampleRate)
floatSamples
- Array of float audio samples (in [-1, 1] range)sampleRate
- Sample rate of the audio, HzAntispoofResult
VoiceSdkEngineException
- wraps native exceptionspublic AntispoofResult isSpoof(java.lang.String audioFile)
audioFile
- Path to the audio fileAntispoofResult
VoiceSdkEngineException
- wraps native exceptionsprotected static long init(java.lang.String initPath)
protected void release()
VoiceSdkNativePeer
release
in class VoiceSdkNativePeer
protected AntispoofResult isSpoof1(byte[] pcm16Bytes, int sampleRate)
protected AntispoofResult isSpoof2(short[] pcm16Samples, int sampleRate)
protected AntispoofResult isSpoof3(float[] floatSamples, int sampleRate)
protected AntispoofResult isSpoof4(java.lang.String audioFile)