|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ddf.minim.analysis.WindowFunction
public abstract class WindowFunction
A Window function represents a curve which is applied to a sample buffer to reduce the introduction of spectral leakage in the Fourier transform.
Windowing
Windowing is the process of shaping the audio samples before transforming them to the frequency domain. The Fourier Transform assumes the sample buffer is is a repetitive signal, if a sample buffer is not truly periodic within the measured interval sharp discontinuities may arise that can introduce spectral leakage. Spectral leakage is the speading of signal energy across multiple FFT bins. This "spreading" can drown out narrow band signals and hinder detection.
A windowing function
attempts to reduce spectral leakage by attenuating the measured sample buffer
at its end points to eliminate discontinuities. If you call the window()
function with an appropriate WindowFunction, such as HammingWindow()
,
the sample buffers passed to the object for analysis will be shaped by the current
window before being transformed. The result of using a window is to reduce
the leakage in the spectrum somewhat.
WindowFunction
handles work associated with various window functions
such as the Hamming window. To create your own window function you must extend
WindowFunction
and implement the value
method which defines the shape of the window at a given offset.
WindowFunction
will call this method to apply the window to
a sample buffer. The number passed to the method is an offset within the length
of the window curve.
Field Summary | |
---|---|
protected int |
length
|
protected static float |
TWO_PI
The float value of 2*PI. |
Constructor Summary | |
---|---|
WindowFunction()
|
Method Summary | |
---|---|
void |
apply(float[] samples)
Apply the window function to a sample buffer. |
float[] |
generateCurve(int length)
Generates the curve of the window function. |
protected abstract float |
value(int length,
int index)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final float TWO_PI
protected int length
Constructor Detail |
---|
public WindowFunction()
Method Detail |
---|
public void apply(float[] samples)
samples
- a sample bufferpublic float[] generateCurve(int length)
length
- the length of the window
protected abstract float value(int length, int index)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |