T - typed class.public abstract class AbstractVAD<T extends com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.config.VADConfig> extends Object implements com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetector
com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetector.VADState| Modifier | Constructor and Description |
|---|---|
protected |
AbstractVAD(int sampleRate,
T vadConfig)
Create a VAD with given audio sample rate and configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Override
Closeable.close() method to ignore the IOException,
which is not necessary for our VAD use case. |
protected ByteBuffer |
createVAD(boolean useDNN)
Create VAD..
|
protected int |
destroyVAD(ByteBuffer vadInstance)
Free VAD memory.
|
protected int |
isSpeech(ByteBuffer vadInstance,
short[] samples,
int sampleRate)
Check if audio contains speech.
|
com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetector.VADState |
processSamples(short[] samples,
int samplesRead)
Process audio samples using the Voice Activity Detector.
|
protected int |
setDNNThreshold(ByteBuffer vadInstance,
float threshold)
Set the specific threshold for the DNN VAD.
|
protected abstract ByteBuffer |
setupVAD(T vadConfig)
Abstract method to setup the VAD.
|
protected int |
setWebRtcCustomizedMode(ByteBuffer vadInstance,
int overHangMax1,
int overHangMax2,
int localThreshold,
int globalThreshold)
Set the customized aggression mode for the WebRtc VAD.
|
protected int |
setWebRtcMode(ByteBuffer vadInstance,
int aggressionMode)
Set the aggression mode for the WebRtc VAD.
|
protected AbstractVAD(int sampleRate,
T vadConfig)
sampleRate - audio sample rate.vadConfig - configuration used to set up the VAD.protected abstract ByteBuffer setupVAD(T vadConfig)
vadConfig - the configuration used to set up the VAD.public final com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetector.VADState processSamples(short[] samples, int samplesRead) throws com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VADException
com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetectorprocessSamples in interface com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetectorsamples - the samples to process.samplesRead - the number of samples in the buffer.com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VADException - if there's an error processing the samples.public void close()
com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetectorCloseable.close() method to ignore the IOException,
which is not necessary for our VAD use case.close in interface com.amazonaws.mobileconnectors.lex.interactionkit.internal.vad.VoiceActivityDetectorclose in interface Closeableclose in interface AutoCloseableprotected ByteBuffer createVAD(boolean useDNN)
useDNN - flag to indicate whether use DNN implementation or WebRtc implementation.protected int setWebRtcMode(ByteBuffer vadInstance, int aggressionMode)
vadInstance - the WebRtc VAD.aggressionMode - the aggression mode.protected int setWebRtcCustomizedMode(ByteBuffer vadInstance, int overHangMax1, int overHangMax2, int localThreshold, int globalThreshold)
vadInstance - the WebRtc VAD.overHangMax1 - the 1st max over hang value.overHangMax2 - the 2nd max over hang value.localThreshold - the local threshold.globalThreshold - the global threshold.protected int setDNNThreshold(ByteBuffer vadInstance, float threshold)
vadInstance - the DNN VAD.threshold - the LRT threshold value.protected int destroyVAD(ByteBuffer vadInstance)
vadInstance - the VAD instance.protected int isSpeech(ByteBuffer vadInstance, short[] samples, int sampleRate)
vadInstance - the native VAD instance.samples - the audio buffer.sampleRate - the sample rate of the audio.Copyright © 2018. All rights reserved.