public class SilenceDetector extends java.lang.Object implements AudioProcessor
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_SILENCE_THRESHOLD |
| Constructor and Description |
|---|
SilenceDetector()
Create a new silence detector with a default threshold.
|
SilenceDetector(double silenceThreshold,
boolean breakProcessingQueueOnSilence)
Create a new silence detector with a defined threshold.
|
| Modifier and Type | Method and Description |
|---|---|
double |
currentSPL() |
boolean |
isSilence(float[] buffer) |
boolean |
isSilence(float[] buffer,
double silenceThreshold)
Checks if the dBSPL level in the buffer falls below a certain threshold.
|
boolean |
process(AudioEvent audioEvent)
Process the audio event.
|
void |
processingFinished()
Notify the AudioProcessor that no more data is available and processing
has finished.
|
public static final double DEFAULT_SILENCE_THRESHOLD
public SilenceDetector()
public SilenceDetector(double silenceThreshold,
boolean breakProcessingQueueOnSilence)
silenceThreshold - The threshold which defines when a buffer is silent (in dB).
Normal values are [-70.0,-30.0] dB SPL.breakProcessingQueueOnSilence - public double currentSPL()
public boolean isSilence(float[] buffer,
double silenceThreshold)
buffer - The buffer with audio information.silenceThreshold - The threshold in dBSPLpublic boolean isSilence(float[] buffer)
public boolean process(AudioEvent audioEvent)
AudioProcessorprocess in interface AudioProcessoraudioEvent - The audio event that contains audio data.public void processingFinished()
AudioProcessorprocessingFinished in interface AudioProcessor