The source-code.biz Java DSP collection
A collection of Java classes for Digital Signal Processing
Overview of the primary classes
Digital filtering
Java Sound integration of the filter modules
IirFilterAudioInputStreamFisher
| apidocs
| source
| Provides an AudioInputStream for filtering. Fisher version.
|
IirFilterAudioInputStreamExstrom
| apidocs
| source
| Provides an AudioInputStream for filtering. Exstrom version.
|
EchoFilterAudioInputStream
| apidocs
| source
| Provides an AudioInputStream that adds an echo to a sound.
|
Signal analysis / generation / modification
Transforms
Math
Visualization (Swing based)
FunctionPlot
| apidocs
| source
| A simple function plot component.
|
SignalPlot
| apidocs
| source
| A Swing component for plotting a sampled signal. (like a very simple "oscilloscope").
|
TransferFunctionPlot
| apidocs
| source
| A component to display the transfer curve of a filter.
|
Overview of the test and utility programs
Filter visualization
Use the mouse to zoom and scroll within the plot area.
TestIirFilterTransferPlotFisher
| source
| Displays the transfer function (linear gain and phase) of an IIR filter, Fisher version.
|
TestIirFilterTransferPlotExstrom
| source
| Displays the transfer function (linear gain and phase) of an IIR filter, Exstrom version.
|
TestIirFilterResponsePlotFisher
| source
| Displays the impulse or step response of an IIR filter, Fisher version.
|
TestIirFilterResponsePlotExstrom
| source
| Displays the impulse or step response of an IIR filter, Exstrom version.
|
Test and utility programs that operate on WAV files
The WAV files may be mono or multi-channel and 16 or 24 bit. But some of the programs only process the first channel.
WavFilterFisher
| source
| Filters a WAV file. Fisher version. Supports multi-channel WAV files.
|
WavFilterExstrom
| source
| Filters a WAV file. Exstrom version. Supports multi-channel WAV files.
|
WavSplitter
| source
| Splits a WAV file into multiple WAV files, according to the silence gaps within the record.
|
TestSignalPlot
| source
| A simple test program to display the signal of a WAV file.
|
TestEnvelopeDetector
| source
| Generates the envelope of a signal in a WAV file and writes it into another WAV file.
|
TestBrownNoiseGenerator
| source
| Generates a WAV file with brown noise.
|
TestRmsNormalizer
| source
| Reads a WAV file, normalizes it's amplitude level and writes the result into another WAV file.
|
Simple test programs for individual classes
TestBesselFilterDesign
| source
| Prints bessel polynomial coeffcients, Bessel filter frequency scaling factors and Bessel filter poles.
|
TestIirFilterDesignExstrom
| source
| Designs an IIR filter using the Exstrom method and prints the IIR filter coefficients.
|
TestIirFilterDesignFisher
| source
| Designs an IIR filter using the Fisher method and prints the IIR filter coefficients.
|
TestFunctionPlot
| source
| Displays a sin(x)/x function using the FunctionPlot class. Use the mouse to zoom and scroll.
|
TestEchoFilter
| source
| Real-time test program for the echo filter (microphone in / speaker out).
|
Test programs for quality assurance (QA) for some classes in this collection
TestDft
| source
| QA tests for the DFT / IDFT routines.
|
TestIirFilterDesignExstromJavaC
| source
| Uses random numbers to test various filter designs with the Exstrom method and compares the
computed filter coefficients with the output of the C programs from Exstrom.
|
TestIirFilterDesignRandom
| source
| Uses random numbers to design various filters and compares the results of the
Exstrom and Fisher modules.
|
TestPolynomialRootFinder
| source
| QA test program for the polynomial root finder classes (Jenkins-Traub and Laguerre).
It first verifies the results for some examples. Then it uses random numbers to generate various polynomials,
find their roots (zeros) and verify that the roots are correct by computing the polonomial coefficients from the roots
(expansion) and comparing the coefficients.
|
TestPolynomialUtils
| source
| Some simple QA tests for the PolynomialUtils routines.
|
Some examples of how to use the test programs
Filter a WAV file with a 4th order Chebyshev bandpass for 1000 - 2000 Hz and -0.5 dB ripple:
java -cp dsp-collection.jar WavFilterFisher in.wav bandpass chebyshev 4 -0.5 1000 2000 out.wav
Display the transfer function, the step response and the impulse response of a 9th order Chebyshev lowpass filter
with -1 dB ripple.
(Use the mouse to zoom and scroll within the plot areas)
java -cp dsp-collection.jar TestIirFilterTransferPlotFisher lowpass chebyshev 9 -1 0.25 0
java -cp dsp-collection.jar TestIirFilterResponsePlotFisher lowpass chebyshev 9 -1 0.25 0 step
java -cp dsp-collection.jar TestIirFilterResponsePlotFisher lowpass chebyshev 9 -1 0.25 0 impulse
And here an example of how the transfer curve looks like when an IIR filter is instable.
Zoom in at the upper left edge of the gain curve.
When you increase the filter order, e.g. from 5 to 6, the effect gets worse.
java -cp dsp-collection.jar TestIirFilterTransferPlotFisher bandpass butterworth 5 0 0.0025 0.025