Package net.idrnd.voicesdk.media
Class SNRComputer
java.lang.Object
net.idrnd.voicesdk.common.VoiceSdkNativePeer
net.idrnd.voicesdk.media.SNRComputer
- All Implemented Interfaces:
AutoCloseable
Calculates average Signal-to-Noise ratio, dB in the specified audio data.
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatcompute(byte[] pcm16Bytes, int sampleRate) Calculates SNR over the specified audio buffer provided as an array of PCM16 samples.floatcompute(float[] floatSamples, int sampleRate) Calculates SNR over the specified audio buffer provided as an array of normalized float values.floatcompute(short[] pcm16Samples, int sampleRate) Calculates SNR over the specified audio buffer provided as an array of PCM16 samples.floatCalculates SNR over the specified audio record.Methods inherited from class net.idrnd.voicesdk.common.VoiceSdkNativePeer
close, equals, hashCode
-
Constructor Details
-
SNRComputer
Initializes the instance.- Parameters:
initPath- exactly the same as forSpeechSummaryEngine- Throws:
VoiceSdkEngineException- wraps native exceptions
-
-
Method Details
-
compute
public float compute(byte[] pcm16Bytes, int sampleRate) Calculates SNR over the specified audio buffer provided as an array of PCM16 samples.- Parameters:
pcm16Bytes- Array of little-endian PCM16 audio bytessampleRate- audio stream sampling rate, Hz- Returns:
- average SNR, dB
- Throws:
VoiceSdkEngineException- wraps native exceptions
-
compute
public float compute(short[] pcm16Samples, int sampleRate) Calculates SNR over the specified audio buffer provided as an array of PCM16 samples.- Parameters:
pcm16Samples- Array of PCM16 audio samplessampleRate- audio stream sampling rate, Hz- Returns:
- average SNR, dB
- Throws:
VoiceSdkEngineException- wraps native exceptions
-
compute
public float compute(float[] floatSamples, int sampleRate) Calculates SNR over the specified audio buffer provided as an array of normalized float values.- Parameters:
floatSamples- Array of float audio samples (in [-1, 1] range)sampleRate- audio stream sampling rate, Hz- Returns:
- average SNR, dB
- Throws:
VoiceSdkEngineException- wraps native exceptions
-
compute
Calculates SNR over the specified audio record.- Parameters:
audioFile- Path to the audio file- Returns:
- average SNR, dB
- Throws:
VoiceSdkEngineException- wraps native exceptions
-