|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGoertzel
The Goertzel class can be used to perform the Goertzel algorithm. In order to use this class, four primary steps should be executed: initialize the Goertzel class and all its variables (initGoertzel), process one sample of data at a time (processSample), get the relative magnitude returned by the Goertzle algorithm after N samples have been processed (getMagnitudeSquared, getRealImag), and reset the Goertzel class and all its variables (resetGoertzel).
This class is based on a C program implemented by Kevin Banks of Embedded Systems Programming.
Field Summary | |
boolean |
debug
|
Fields inherited from interface Constants |
AVG_DETECT_TIME, BIGEND, DEBOUNCE_VAL, GROUPADDR, HISTORY_SIZE, MAX_DETECT_TIME, MAXMSGSIZE, N, NUMTHREADS, PORTNUM, ROOM_MSG_BUF, SAMPLE_SIZE, SAMPLING_RATE, SEQUENCE, SIGN, TARGET_FREQUENCY, WEIGHT |
Constructor Summary | |
Goertzel()
Default Constructor. |
|
Goertzel(float sampleRate,
float targetFreq,
int inN,
boolean inDebug)
Constructor |
Method Summary | |
double |
getMagnitudeSquared()
Optimized Goertzel. |
double[] |
getRealImag(double[] parts)
Basic Goertzel. |
void |
initGoertzel()
Call this once, to precompute the constants. |
static void |
main(java.lang.String[] args)
The main function used for testing. |
void |
processSample(double sample)
Call this routine for every sample. |
void |
resetGoertzel()
Call this method after every block of N samples has been processed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public boolean debug
Constructor Detail |
public Goertzel()
public Goertzel(float sampleRate, float targetFreq, int inN, boolean inDebug)
sampleRate
- is the sampling rate of the signal to be analyzedtargetFreq
- is the frequency that Goertzel will look for.inN
- is the block size to use with GoertzelinDebug
- indicates whether or not to turn debugging info on.Method Detail |
public void resetGoertzel()
public void initGoertzel()
public void processSample(double sample)
sample
- is a double
public double[] getRealImag(double[] parts)
parts
- has length two where the first item is the real
part and the second item is the complex part.
public double getMagnitudeSquared()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |