|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hermit.android.instruments.Instrument
org.hermit.android.instruments.AudioAnalyser
public class AudioAnalyser
An Instrument
which analyses an audio stream in various ways.
To use this class, your application must have permission RECORD_AUDIO.
Constructor Summary | |
---|---|
AudioAnalyser(SurfaceRunner parent)
Create a WindMeter instance. |
Method Summary | |
---|---|
void |
appStart()
The application is starting. |
void |
appStop()
The application is closing down. |
void |
doUpdate(long now)
Update the state of the instrument for the current frame. |
PowerGauge |
getPowerGauge(SurfaceRunner surface)
Get a signal power gauge for this audio analyser. |
SpectrumGauge |
getSpectrumGauge(SurfaceRunner surface)
Get a spectrum analyser gauge for this audio analyser. |
WaveformGauge |
getWaveformGauge(SurfaceRunner surface)
Get a waveform gauge for this audio analyser. |
void |
measureStart()
We are starting the main run; start measurements. |
void |
measureStop()
We are stopping / pausing the run; stop measurements. |
protected void |
restoreState(Bundle icicle)
Restore the game state from the given Bundle. |
protected void |
saveState(Bundle icicle)
Save the state of the game in the provided Bundle. |
void |
setAverageLen(int len)
Set the histogram averaging window for this instrument. |
void |
setBlockSize(int size)
Set the input block size for this instrument. |
void |
setDecimation(int rate)
Set the decimation rate for this instrument. |
void |
setSampleRate(int rate)
Set the sample rate for this instrument. |
void |
setWindowFunc(org.hermit.dsp.Window.Function func)
Set the spectrum analyser windowing function for this instrument. |
Methods inherited from class org.hermit.android.instruments.Instrument |
---|
getSurface |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AudioAnalyser(SurfaceRunner parent)
parent
- Parent surface.Method Detail |
---|
public void setSampleRate(int rate)
rate
- The desired rate, in samples/sec.public void setBlockSize(int size)
size
- The desired block size, in samples. Typical
values would be 256, 512, or 1024. Larger block
sizes will mean more work to analyse the spectrum.public void setWindowFunc(org.hermit.dsp.Window.Function func)
func
- The desired windowing function.
Window.Function.BLACKMAN_HARRIS is a good option.
Window.Function.RECTANGULAR turns off windowing.public void setDecimation(int rate)
rate
- The desired decimation. Only 1 in rate blocks
will actually be processed.public void setAverageLen(int len)
len
- The averaging interval. 1 means no averaging.public void appStart()
appStart
in class Instrument
public void measureStart()
measureStart
in class Instrument
public void measureStop()
measureStop
in class Instrument
public void appStop()
appStop
in class Instrument
public WaveformGauge getWaveformGauge(SurfaceRunner surface)
surface
- The surface in which the gauge will be displayed.
public SpectrumGauge getSpectrumGauge(SurfaceRunner surface)
surface
- The surface in which the gauge will be displayed.
public PowerGauge getPowerGauge(SurfaceRunner surface)
surface
- The surface in which the gauge will be displayed.
public final void doUpdate(long now)
SurfaceRunner
.
Since this is called frequently, we first check whether new audio data has actually arrived.
doUpdate
in class Instrument
now
- Nominal time of the current frame in ms.protected void saveState(Bundle icicle)
saveState
in class Instrument
icicle
- The Bundle in which we should save our state.protected void restoreState(Bundle icicle)
restoreState
in class Instrument
icicle
- The Bundle containing the saved state.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |