public final class PreASRMicrophoneInput extends Object implements SpeechInput
MicrophoneInput that releases its internal AudioRecord when ASR is activated to avoid microphone conflicts.
This class uses the configured sample rate and always reads single-chanel 16-bit PCM samples.
| Constructor and Description |
|---|
PreASRMicrophoneInput(SpeechConfig config)
initializes a new microphone instance and opens the audio recorder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases the resources associated with the microphone.
|
void |
read(SpeechContext context,
ByteBuffer frame)
Reads a frame from the microphone if the pipeline is inactive.
|
public PreASRMicrophoneInput(SpeechConfig config)
config - speech pipeline configurationpublic void close()
close in interface AutoCloseablepublic void read(SpeechContext context, ByteBuffer frame) throws AudioRecordError
read in interface SpeechInputcontext - the current speech contextframe - the frame buffer to fillAudioRecordError - if audio cannot be readCopyright © 2021. All rights reserved.