TarsosDSP is a collection of classes to do simple audio processing. It features an implementation of a percussion onset detector and two pitch detection algorithms: Yin and the Mcleod Pitch method. Also included is a Goertzel DTMF decoding algorithm and a time stretch algorithm (WSOLA).
Its aim is to provide a simple interface to some audio (signal) processing algorithms implemented in pure JAVA. Some TarsosDSP example applications are available.
The following example filters a band of frequencies of an input file
testFile. It keeps the frequencies form
AudioInputStream inputStream = AudioSystem.getAudioInputStream(testFile); AudioDispatcher dispatcher = new AudioDispatcher(inputStream,stepSize,overlap); dispatcher.addAudioProcessor(new HighPass(startFrequency, sampleRate, overlap)); dispatcher.addAudioProcessor(new LowPassFS(stopFrequency, sampleRate, overlap)); dispatcher.addAudioProcessor(new FloatConverter(format)); dispatcher.addAudioProcessor(new WaveformWriter(format,stepSize, overlap, "filtered.wav")); dispatcher.run();
The source tree is divided in three directories:
srccontains the source files of the core DSP libraries.
testcontains unit tests for some of the DSP functionality.
buildcontains ANT build files. Either to build Java documentation or runnable JAR-files for the example applications.
examplescontains a couple of example applications with a Java Swing user interface:
- SoundDetector show how you loudness calculations can be done. When input sound is over a defined limit an event is fired.
- PitchDetector this demo application shows real-time pitch detection. When pitch is detected the hertz value is printed together with a probability.
- PercussionDetector show the percussion (onset) dectection. Clapping your hands causes an event. This demo application also shows the influence of the two parameters on the algorithm.
- UtterAsterisk a game with the goal to sing as close to a melody a possible. Technically it shows real-time pitch detection with YIN or MPM.
- Spectrogram in Java shows a spectrogram and detected pitch, either live or from an audio file. It is interesting to see which frequencies are picked as fundamentals.
- Goertzel DTMF decoding an implementation of the Goertzel Algorithm. A fancy user interface shows what goes on under the hood.
- Audio Time Stretching – Implementation in Pure Java Using WSOLA Similarity Overlap Add) an implementation of the a time stretching algorithm. By using WSOLA it is possilbe to change the playback speed while audio is playing.
The onset detector implementation is based on a VAMP plugin example by Chris Cannam at Queen Mary, London.