public final class SignalPowerExtractor
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SignalPowerExtractor.WaveFormDataAggregator |
| Constructor and Description |
|---|
SignalPowerExtractor(AudioFile file)
Create a new power extractor.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isSilence(float[] buffer) |
static boolean |
isSilence(float[] buffer,
double silenceThreshold)
Checks if the dBSPL level in the buffer falls below a certain threshold.
|
static double |
localEnergy(float[] buffer)
Calculates the local (linear) energy of an audio buffer.
|
double |
powerAt(double seconds,
boolean relative)
Returns the relative power [0.0;1.0] at the given time.
|
void |
saveTextFile(java.lang.String textFileName,
boolean relative)
Creates a text file with relative power values for each sample.
|
static double |
soundPressureLevel(float[] buffer)
Returns the dBSPL for a buffer.
|
void |
waveFormPlot(SignalPowerExtractor.WaveFormDataAggregator aggregator)
Creates a wave from plot.
|
public SignalPowerExtractor(AudioFile file)
file - The audio file to extract power from.public double powerAt(double seconds,
boolean relative)
seconds - The time to get the relative power for.relative - java.lang.IndexOutOfBoundsException - when the number of seconds is not between the start and
end of the song.public void waveFormPlot(SignalPowerExtractor.WaveFormDataAggregator aggregator)
aggregator - The aggregator to save to.public void saveTextFile(java.lang.String textFileName,
boolean relative)
textFileName - Where to save the text file?relative - Compare the current power with the max extracted power, or not?public static double localEnergy(float[] buffer)
buffer - The audio buffer.public static double soundPressureLevel(float[] buffer)
buffer - The buffer with audio information.public static boolean isSilence(float[] buffer,
double silenceThreshold)
buffer - The buffer with audio information.silenceThreshold - The threshold in dBSPLpublic static boolean isSilence(float[] buffer)