public final class SpeechSampler extends Object implements SpeechProcessor
This is the spokestack pipeline component for logging speech samples. The samples are written in the wav format to the configured output directory with rotating file names. The sampler is useful for debugging pipeline configuration, microphone levels, etc. The sampler only logs audio samples that correspond to speech (where context.isSpeech() is true).
This pipeline component supports the following configuration properties:
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SAMPLE_MAX
default maximum number of rotated sample files.
|
Constructor and Description |
---|
SpeechSampler(SpeechConfig config)
constructs a new sampler instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
destroys the resources attached to the copmonent.
|
void |
process(SpeechContext context,
ByteBuffer frame)
processes a frame of audio.
|
void |
reset()
resets all state internal to the stage.
|
public static final int DEFAULT_SAMPLE_MAX
public SpeechSampler(SpeechConfig config) throws Exception
config
- the pipeline configuration instanceException
- on errorpublic void reset() throws Exception
SpeechProcessor
reset
in interface SpeechProcessor
Exception
- on errorpublic void close() throws Exception
close
in interface AutoCloseable
Exception
- on errorpublic void process(SpeechContext context, ByteBuffer frame) throws Exception
process
in interface SpeechProcessor
context
- the current speech contextframe
- the audio frame to detectException
- on errorCopyright © 2020. All rights reserved.