public class SNRComputer 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 |
---|
SNRComputer(java.lang.String initPath)
Initializes the instance.
|
Modifier and Type | Method and Description |
---|---|
float |
compute(byte[] pcm16Bytes,
int sampleRate)
Calculates SNR over the specified audio buffer provided as an array of PCM16 samples.
|
float |
compute(float[] floatSamples,
int sampleRate)
Calculates SNR over the specified audio buffer provided as an array of normalized float values.
|
float |
compute(short[] pcm16Samples,
int sampleRate)
Calculates SNR over the specified audio buffer provided as an array of PCM16 samples.
|
float |
compute(java.lang.String audioFile)
Calculates SNR over the specified audio record.
|
protected float |
compute1(byte[] pcm16Bytes,
int sampleRate) |
protected float |
compute2(short[] pcm16Samples,
int sampleRate) |
protected float |
compute3(float[] floatSamples,
int sampleRate) |
protected float |
compute4(java.lang.String audioFile) |
protected static long |
init(java.lang.String initPath) |
protected void |
release()
This method should release resources on native layer (indirectly using nativeId)
|
close, equals, finalize, hashCode
public SNRComputer(java.lang.String initPath)
initPath
- exactly the same as for SpeechSummaryEngine
VoiceSdkEngineException
- wraps native exceptionspublic float compute(byte[] pcm16Bytes, int sampleRate)
pcm16Bytes
- Array of little-endian PCM16 audio bytessampleRate
- audio stream sampling rate, HzVoiceSdkEngineException
- wraps native exceptionspublic float compute(short[] pcm16Samples, int sampleRate)
pcm16Samples
- Array of PCM16 audio samplessampleRate
- audio stream sampling rate, HzVoiceSdkEngineException
- wraps native exceptionspublic float compute(float[] floatSamples, int sampleRate)
floatSamples
- Array of float audio samples (in [-1, 1] range)sampleRate
- audio stream sampling rate, HzVoiceSdkEngineException
- wraps native exceptionspublic float compute(java.lang.String audioFile)
audioFile
- Path to the audio fileVoiceSdkEngineException
- wraps native exceptionsprotected static long init(java.lang.String initPath)
protected void release()
VoiceSdkNativePeer
release
in class VoiceSdkNativePeer
protected float compute1(byte[] pcm16Bytes, int sampleRate)
protected float compute2(short[] pcm16Samples, int sampleRate)
protected float compute3(float[] floatSamples, int sampleRate)
protected float compute4(java.lang.String audioFile)