public class SpeechSummaryStream extends VoiceSdkNativePeer
SpeechSummary
in the streaming scenarios.
This class is stateful and the SpeechSummary
statistics is being recalculated after every addSamples(byte[])
method.
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
SpeechSummaryEngine.createStream(int)
nativeId
Modifier | Constructor and Description |
---|---|
protected |
SpeechSummaryStream(long nativeId) |
Modifier and Type | Method and Description |
---|---|
void |
addSamples(byte[] bytes)
Adds audio samples for processing in PCM16 format
|
void |
addSamples(float[] floatSamples)
Adds audio samples for processing encoded in normalized float format
|
void |
addSamples(short[] pcm16Samples)
Adds audio samples for processing in PCM16 format
|
protected void |
addSamples1(byte[] bytes) |
protected void |
addSamples2(short[] pcm16Samples) |
protected void |
addSamples3(float[] floatSamples) |
void |
finalizeStream()
Finalizes input audio stream to process remaining audio samples and produce result if it's possible
|
float |
getCurrentBackgroundLength()
Retrieves accumulated background length metric
|
SpeechEvent |
getSpeechEvent()
Retrieves a single speech event from output FIFO queue.
|
java.util.List<SpeechEvent> |
getSpeechEvents()
Fetches accumulated list of speech events, removing them from stream queue.
|
SpeechInfo |
getTotalSpeechInfo()
Retrieves accumulated speech info data.
|
SpeechSummary |
getTotalSpeechSummary()
Retrieves accumulated speech summary data.
|
boolean |
hasSpeechEvents()
Checks if there are available speech events in output queue
|
protected void |
release()
This method should release resources on native layer (indirectly using nativeId)
|
void |
reset()
Resets stream state: clears buffer, resets speech summary
|
close, equals, finalize, hashCode
public void addSamples(byte[] bytes)
bytes
- Array of little-endian PCM16 audio bytesVoiceSdkEngineException
- wraps native exceptionspublic void addSamples(short[] pcm16Samples)
pcm16Samples
- Array of PCM16 audio samplesVoiceSdkEngineException
- wraps native exceptionspublic void addSamples(float[] floatSamples)
floatSamples
- Array of float audio samples (in [-1, 1] range)VoiceSdkEngineException
- wraps native exceptionspublic SpeechSummary getTotalSpeechSummary()
SpeechSummary
VoiceSdkEngineException
- wraps native exceptionspublic SpeechInfo getTotalSpeechInfo()
SpeechInfo
VoiceSdkEngineException
- wraps native exceptionspublic float getCurrentBackgroundLength()
VoiceSdkEngineException
- wraps native exceptionsSpeechInfo.getBackgroundLengthMs()
public boolean hasSpeechEvents()
public SpeechEvent getSpeechEvent()
hasSpeechEvents()
to check if there is available speech event.VoiceSdkEngineException
- wraps native exceptionspublic java.util.List<SpeechEvent> getSpeechEvents()
VoiceSdkEngineException
- wraps native exceptionspublic void finalizeStream()
public void reset()
protected void release()
VoiceSdkNativePeer
release
in class VoiceSdkNativePeer
protected void addSamples1(byte[] bytes)
protected void addSamples2(short[] pcm16Samples)
protected void addSamples3(float[] floatSamples)