|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.hogent.tarsos.util.SignalPowerExtractor
public final class SignalPowerExtractor
An utility class to calculate and access the power of an audio file at any given time.
Nested Class Summary | |
---|---|
static interface |
SignalPowerExtractor.WaveFormDataAggregator
|
Constructor Summary | |
---|---|
SignalPowerExtractor(AudioFile file)
Create a new power extractor. |
Method Summary | |
---|---|
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 |
savePowerPlot(java.lang.String powerPlotFileName,
double silenceThreshold)
Creates a 'power plot' of the signal. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SignalPowerExtractor(AudioFile file)
file
- The audio file to extract power from.Method Detail |
---|
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 void savePowerPlot(java.lang.String powerPlotFileName, double silenceThreshold)
powerPlotFileName
- Where to save the plot.silenceThreshold
- Draw a line at this threshold. Can be used to show where the
signal is 'silent'.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 dBSPL
public static boolean isSilence(float[] buffer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |