---
title: Posts tagged TarsosDSP
canonical: https://0110.be/tags/TarsosDSP
markdown_url: https://0110.be/tags/TarsosDSP.md
page: 0
posts_per_page: 30
total_posts: 25
filters:
  tag: TarsosDSP
previous:
next:
---

# Posts tagged TarsosDSP

## [Updates for TarsosDSP](https://0110.be/posts/Updates_for_TarsosDSP.md)

- Published: 2023-01-20T00:00:00Z
- Updated: 2023-01-27T15:51:31Z
- Author: Joren
- ID: 503
- Canonical: https://0110.be/posts/Updates_for_TarsosDSP

- Tags: [Code](https://0110.be/tags/Code.md), [Music Information Retrieval](https://0110.be/tags/Music%20Information%20Retrieval.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

TarsosDSP is a Java library for audio processing I have started working on more than 10 years ago. The aim of TarsosDSP is to provide an easy-to-use interface to practical music processing algorithms. Obviously, I have been using it myself over the years as my go-to library for audio-processing in Java. However, a number of gradual changes in the java ecosystem made TarsosDSP more and more difficult to use.

Since I have apparently not been the only one using it, there was a need to give it some attention. During the last couple of weeks I have found the time to give it this much needed attention. This resulted in a number of updates, some of the changes include:

-   Change of the build system from Apache Ant to Gradle

-   Make use of Java Modules to make TarsosDSP compatible with the ModulePath introduced in Java 9.

-   Packaged the software into a maven compatible format, which makes it easy to use as a dependency.

-   CI with GitHub actions to automatically build and test the software.

-   Updated some examples shipped with the TarsosDSP. I have still still some examples to verify.

-   Improved handling of errors on reading audio via ffmpeg

<center>
<img width="60%" src="https://0110.be/files/attachments/503/tarsosdsp_gui_examples.webp" alt="Examples of TarsosDSP"><br>\
<small>Fig: The updated TarsosDSP release contains many CLI and GUI example applications.</small>

</center>
Notably **the code of TarsosDSP has not changed much** apart from some cosmetic changes. This backwards compatibility is one of the strong points of Java. With this update I am quite confident that TarsosDSP will also be usable during the next decade as well.

Please check out the updated [TarsosDSP repository on GitHub](https://github.com/JorenSix/TarsosDSP). <br>


![Flanger](https://0110.be/files/photos/503/tarsosdsp_flanger_effect.webp)

![Oscilloscope](https://0110.be/files/photos/503/tarsosdsp_oscilloscope.webp)

![Pitch estimator](https://0110.be/files/photos/503/tarsosdsp_pitch_detector.png)

---

## [Control Audio Time Stretching and Pitch Shifting from Java using Rubber Band And JNI](https://0110.be/posts/Control_Audio_Time_Stretching_and_Pitch_Shifting_from_Java_using_Rubber_Band_And_JNI.md)

- Published: 2015-08-05T00:00:00Z
- Updated: 2025-11-29T19:46:33Z
- Author: Joren
- ID: 437
- Canonical: https://0110.be/posts/Control_Audio_Time_Stretching_and_Pitch_Shifting_from_Java_using_Rubber_Band_And_JNI

- Tags: [Code](https://0110.be/tags/Code.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

This post explains how to do real-time pitch-shifting and audio time-stretching in Java. It uses two components. The first component is [a high quality software C library for audio time-stretching and pitch-shifting C called Rubber Band](http://breakfastquay.com/rubberband/). The second component is a Java audio library called [TarsosDSP](https://github.com/JorenSix/TarsosDSP). To bridge the gap between the two JNI (Java Native Interface) is used. Rubber Band provides a JNI interface and starting from the currently unreleased version 1.8.2, makefiles are provided that make compiling and subsequently using the JNI version of Rubber Band relatively straightforward.

However, it still requires some effort to control real-time pitch-shifting and audio time-stretching from java. To make it more easy some example code and documentation is available in a GitHub repository called [RubberBandJNI](https://github.com/JorenSix/RubberBandJNI). It documents some of the configuration steps needed to get things working. It also offers precompiled libraries and documents how to compile those for the following systems:

-   [Audio Time-Stretching vdia JNI on Debian](https://github.com/JorenSix/RubberBandJNI#compiling-the-rubber-band-jni-library-on-debian-linux)
-   [Audio Time-Stretching via JNI on Mac OS X](https://github.com/JorenSix/RubberBandJNI#compiling-the-rubber-band-jni-library-on-mac-os-x)
-   [Audio Time-Stretching via JNI for Android on Debian](https://github.com/JorenSix/RubberBandJNI#compiling-the-rubber-band-jni-library-on-debian-for-android)

If the instructions are followed rather precisely you are able to control the tempo of a song in real-time with the following Java code:

````java
float tempoFactor = 0.8f;
float pitchFactor = 1.0f;
AudioDispatcher adp = AudioDispatcherFactory.fromPipe("music.mp3", 44100, 4096, 0);
TarsosDSPAudioFormat format = adp.getFormat();
rbs = new RubberBandAudioProcessor(44100, tempoFactor, pitchFactor);
adp.addAudioProcessor(rbs);
adp.addAudioProcessor(new AudioPlayer(JVMAudioInputStream.toAudioFormat(format)));
new Thread(adp).start();
````


![User interfact to control tempo/pitch of audio in Java. It uses RubberBand, a high quality time-stretcher library implemented in C++, called via JNI.](https://0110.be/files/photos/437/rubberband_JNI.png)

---

## [Decode MP3s and other Audio formats the easy way on Android](https://0110.be/posts/Decode_MP3s_and_other_Audio_formats_the_easy_way_on_Android.md)

- Published: 2015-07-14T00:00:00Z
- Updated: 2025-11-29T19:48:15Z
- Author: Joren
- ID: 438
- Canonical: https://0110.be/posts/Decode_MP3s_and_other_Audio_formats_the_easy_way_on_Android

- Tags: [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

This post describes how to decode MP3's using an already compiled ffmpeg binary on android. Using ffmpeg to decode audio on Android has advantages:

-   It supports about every audio format known to man. Three channel flac, vorbis with 32 bit samples, ... do not pose a problem.
-   Extracting audio from video container formats is supported. Accessing the first audio stream from `mkv`, `avi`, `mov`,... just works.
-   Decoding audio frames is more efficient using native code than often buggy Java decoders.
-   Resampling and downmixing is supported. If you want to resample incoming audio to e.g. 44.1kHz and only want single channel audio this is easily achievable.

The main disadvantage is that you need an ffmpeg build for your Android device. Luckily some [poor soul](https://github.com/hiteshsondhi88/ffmpeg-android) already managed to compile ffmeg for Android for several architectures. The [precompiled ffmpeg binaries for Android](https://github.com/hiteshsondhi88/ffmpeg-android/releases/download/v0.3.3/prebuilt-binaries.zip) are available for download and are mirrored [here](https://0110.be/releases/TarsosDSP/TarsosDSP-static-ffmpeg/Android/) as well.

To bridge the ffmpeg binary and the java world TarsosDSP contains some glue code. The `AndroidFFMPEGLocator` is responsible to find and extract the correct binary for your Android device. It expects [these ffmpeg binaries](https://0110.be/releases/TarsosDSP/TarsosDSP-static-ffmpeg/Android/) in the assets folder of your Android application. When the correct ffmpeg binary has been extracted and made executable the `PipeDecoder` is able to call it. The `PipeDecoder` calls ffmpeg so that decoded, downmixed and resampled PCM samples are streamed into the Java application via a pipe, which explains its name.

With the TarsosDSP Android library the following code plays an MP3 from external storage:

````java
new AndroidFFMPEGLocator(this);
new Thread(new Runnable() {
    @Override
    public void run() {
        File externalStorage = Environment.getExternalStorageDirectory();
        File mp3 = new File(externalStorage.getAbsolutePath(), "/audio.mp3");
        AudioDispatcher adp;
        adp = AudioDispatcherFactory.fromPipe(mp3.getAbsolutePath(), 44100, 5000, 2500);
        adp.addAudioProcessor(new AndroidAudioPlayer(adp.getFormat(), 5000, AudioManager.STREAM_MUSIC));
        adp.run();
    }
}).start();
````

This code *just works* if the application has the `READ_EXTERNAL_STORAGE` permission, includes a recent TarsosDSP-Android.jar, is ran on one of the supported ffmpeg architectures and has these binaries available in the assets folder.


---

## [TarsosDSP featured in  EFY Plus Magazine](https://0110.be/posts/TarsosDSP_featured_in__EFY_Plus_Magazine.md)

- Published: 2015-07-09T00:00:00Z
- Updated: 2015-07-10T14:15:55Z
- Author: Joren
- ID: 435
- Canonical: https://0110.be/posts/TarsosDSP_featured_in__EFY_Plus_Magazine

- Tags: [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

<img src="https://0110.be/files/attachments/435/Cover_EFY_Plus_July_2015_Tilted.jpg" width="150px" alt="EFY Plus July 2015 Cover" style="float:right">TarsosDSP, the is a real-time audio processing library written in Java, is featured in [EFY (Electronics For Your) Plus Magazine of July 2015](http://www.efymag.com/currentissue.asp?id=12). It is a leading electronics magazine with a history going back more than 40 years and about 300 000 subscribers mainly in India. The index mentions this:

> *TarsosDSP: A Real-Time Audio Analysis and Processing Framework*\
> In last month's EFY Plus, we discussed Essentia, a C library for audio analysis. In this issue we will discuss a Java based real-time audio analysis and processing framework known as TarsosDSP

To read the full article, buy a ([digital](https://play.google.com/store/apps/details?id=com.vserv.electronicsforyou&hl=en)) copy of the magazine.


---

## [SINGmaster Android App uses TarsosDSP](https://0110.be/posts/SINGmaster_Android_App_uses_TarsosDSP.md)

- Published: 2015-04-24T00:00:00Z
- Updated: 2015-07-10T12:09:11Z
- Author: Joren
- ID: 431
- Canonical: https://0110.be/posts/SINGmaster_Android_App_uses_TarsosDSP

- Tags: [Code](https://0110.be/tags/Code.md), [Java](https://0110.be/tags/Java.md), [Muziek](https://0110.be/tags/Muziek.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

<img src="https://0110.be/files/attachments/431/singmaster_logo.png" width="80px" alt="Singmaster logo" style="float:right">TarsosDSP is a real-time audio processing library written in Java. Since version 2.0 it is compatible with Android. Judging by the number of forks of the [TarsosDSP GitHub repository](https://github.com/JorenSix/TarsosDSP) Android compatibility increased the popularity of the library. Now the first Android application which uses TarsosDSP has found its way to the Google Play store. Download and play with [SINGmaster](https://play.google.com/store/apps/details?id=bg.singmaster.gui) to see an application of the pitch tracking capabilities within TarsosDSP. The SINGmaster description:

> *"SING master is a smart phone app that helps you to learn how to sing. SING master presents a collection of practical exercises (on the most important building blocks of melodies). Colours and sounds guide you in the exercise. After recording, SING master gives visual feedback : you can see and hear your voice. This is important so that you can identify where your mistakes are."*

Another application in the Play Store that uses TarsosDSP is [CuePitcher](https://play.google.com/store/apps/details?id=io.github.mindosoft.cuepitcher).


![SINGMaster screenshot](https://0110.be/files/photos/431/singmaster.png)

![SINGMaster in action](https://0110.be/files/photos/431/singmaster_other.png)

- [singmaster\_logo.png](https://0110.be/files/attachments/431/singmaster_logo.png)

---

## [TarsosDSP PureData or MAX MSP external](https://0110.be/posts/TarsosDSP_PureData_or_MAX_MSP_external.md)

- Published: 2014-09-05T00:00:00Z
- Updated: 2025-11-29T22:18:15Z
- Author: Joren
- ID: 423
- Canonical: https://0110.be/posts/TarsosDSP_PureData_or_MAX_MSP_external

- Tags: [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

<img src="https://0110.be/files/attachments/423/pd_tarsosdsp.png" alt="Pitch detection pure data patch" style="float:left;margin-right:1.5rem;margin-bottom:1.5rem"> It makes sense to connect TarsosDSP, a real-time audio processing library written in Java, with patcher environments such as Pure Data and Max/MSP. Both Pure Data and Max/MSP offer the capability to code object, or externals using Java. In Pure Data this is done using the `pdj~` object, which should be compatible with the Max/MSP implementation. This post demonstrates a patch that connects an oscillator with a pitch tracking algorithm implemented in TarsosDSP.

To the left you can see the finished patch. When it is working an audio stream is generated using an oscillator. The frequency of the oscillator can be controlled. Subsequently the stream is send to the Java environment with the `pdj` bridge. The Java environment receives an array of floats, representing the audio. A pitch estimation algorithm tries to find the pitch of the audio represented by the buffer. The detected pitch is returned to the pd environment by means of outlet. In pd, the detected pitch is shown and used for auditory feedback.

````java
PitchDetectionResult result = yin.getPitch(audioBuffer);
pitch = result.getPitch();
outlet(0, Atom.newAtom(pitch));
````

Please note that the pitch detection algorithm can handle any audio stream, not only pure sines. The example here demonstrates the most straightforward case. Using this method all algorithms implemented in TarsosDSP can be used in Pure Data. These range from onset detection to filtering, from audio effects to wavelet compression. For a list of features, please see the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP). Here, the source for this patch [implementing pitch tracking in pd](https://0110.be/files/attachments/423/tarsosdsp_pd_external.zip) can be downloaded. To run it, extract it to a directory and simply run the `pitch.pd` patch. Pure Data should load `pdj~` automatically together with the classes present in the `classes` directory.


- [tarsosdsp\_pd\_external.zip](https://0110.be/files/attachments/423/tarsosdsp_pd_external.zip)

- [pd\_tarsosdsp.png](https://0110.be/files/attachments/423/pd_tarsosdsp.png)

---

## [TarsosDSP on Android - Audio Processing in Java on Android](https://0110.be/posts/TarsosDSP_on_Android_-_Audio_Processing_in_Java_on_Android.md)

- Published: 2014-08-14T00:00:00Z
- Updated: 2025-11-29T22:28:08Z
- Author: Joren
- ID: 420
- Canonical: https://0110.be/posts/TarsosDSP_on_Android_-_Audio_Processing_in_Java_on_Android

- Tags: [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

<img src="https://0110.be/files/attachments/420/android-audio.jpg"  width="20%" alt="Audio on Android" style="float:right;margin-left:1.5rem;margin-bottom:1.5rem"/>This post explains how to get TarsosDSP running on Android. TarsosDSP is a Java library for audio processing. Its aim is to provide an easy-to-use interface to practical music processing algorithms implemented, as simply as possible, in pure Java and without any other external dependencies.

Since version 2.0 there are no more references to `javax.sound.*` in the TarsosDSP core codebase. This makes it easy to run TarsosDSP on Android. Audio Input/Output operations that depend on either the JVM or Dalvik runtime have been abstracted and removed from the core. For each runtime target a Jar file is provided in the [TarsosDSP release directory](https://0110.be/releases/TarsosDSP).

The source code for the [audio I/O on the JVM](https://github.com/JorenSix/TarsosDSP/tree/master/jvm/be/tarsos/dsp/io/jvm) and the [audio I/O on Android](https://github.com/JorenSix/TarsosDSP/tree/master/android/be/tarsos/dsp/io/android) can be found on GitHub. To get an audio processing algorithm working on Android the only thing that is needed is to place [`TarsosDSP-Android-2.0.jar`](https://0110.be/releases/TarsosDSP/TarsosDSP-2.0/TarsosDSP-Android-2.0.jar) in the `lib` directory of your project.

The following example connects an `AudioDispatcher` to the microphone of an Android device. Subsequently, a real-time pitch detection algorithm is added to the processing chain. The detected pitch in Hertz is printed on a `TextView` element, if no pitch is present in the incoming sound, --1 is printed. To test the application download and install the https://0110.be/files/attachments/420/TarsosDSPAndroid.apk(https://0110.be/files/attachments/420/TarsosDSPAndroid.apk) application on your Android device. The [source code](https://0110.be/files/attachments/420/TarsosDSPAndroid.zip) is available as well.

````java
AudioDispatcher dispatcher = AudioDispatcherFactory.fromDefaultMicrophone(22050, 1024, 0);
PitchDetectionHandler pdh = new PitchDetectionHandler() {
    @Override
    public void handlePitch(PitchDetectionResult result, AudioEvent e) {
        final float pitchInHz = result.getPitch();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                TextView text = (TextView) findViewById(R.id.textView1);
                text.setText("" + pitchInHz);
            }
        });
    }
};
AudioProcessor p = new PitchProcessor(PitchEstimationAlgorithm.FFT_YIN, 22050, 1024, pdh);
dispatcher.addAudioProcessor(p);
new Thread(dispatcher, "Audio Dispatcher").start();
````

Thanks to these changes, the fork of TarsosDSP kindly provided by GitHub user [srubin](https://github.com/srubin/TarsosDSP), created for [a programming assignment at UC Berkley](http://husk.eecs.berkeley.edu/courses/cs160-sp14/index.php/Individual_Programming_Assignment_3), is not needed any more.

Have fun hacking audio on Android!


- [android-audio.jpg](https://0110.be/files/attachments/420/android-audio.jpg)

- [TarsosDSPAndroid.apk](https://0110.be/files/attachments/420/TarsosDSPAndroid.apk)

- [TarsosDSPAndroid.zip](https://0110.be/files/attachments/420/TarsosDSPAndroid.zip)

---

## [Haar Wavlet Transform in TarsosDSP](https://0110.be/posts/Haar_Wavlet_Transform_in_TarsosDSP.md)

- Published: 2014-08-08T00:00:00Z
- Updated: 2014-08-08T13:01:02Z
- Author: Joren
- ID: 422
- Canonical: https://0110.be/posts/Haar_Wavlet_Transform_in_TarsosDSP

- Tags: [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

<img src="https://0110.be/files/attachments/422/Haar_wavelet.svg" width="30%" style="float:right;margin: 10px 10px"> The TarsosDSP Java library for audio processing now contains an implementation of the [Haar Wavelet](https://en.wikipedia.org/wiki/Haar_wavelet) Transform. A discrete wavelet transform based on the Haar wavelet (depicted at the right). This reversible transform has some interesting properties and is practical in signal compression and for analyzing sudden transitions in a file. It can e.g. be used to detect edges in an image.

As an example use case of the Haar transform, a simple lossy audio compression algorithm is implemented in TarsosDSP. It compresses audio by dividing audio into bloks of 32 samples, transforming them using the Haar wavelet Transform and subsequently removing samples with the least difference between them. The last step is to reverse the transform and play the audio. The amount of compressed samples can be chosen between 0 (no compression) and 31 (no signal left). This crude lossy audio compression technique can save at least a tenth of samples without any noticeable effect. A way to store the audio and read it from disk is included as well.

The algorithm works in real time and an example application has been implemented which operates on an mp3 stream. To make this work immediately, the `avconv` tool needs to be on your system's path. Also implemented is a bit depth compressor, which shows the effect of (extreme) bit depth compression.

The example is available at the [TarsosDSP release directory](https://0110.be/releases/TarsosDSP), the code can be found on the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP).


![Haar Wavelet Audio Compression](https://0110.be/files/photos/422/haar_wavelet_audio_compression.png)

---

## [TarsosDSP Spectral Peak extraction](https://0110.be/posts/TarsosDSP_Spectral_Peak_extraction.md)

- Published: 2014-04-10T00:00:00Z
- Updated: 2014-05-07T13:45:08Z
- Author: Joren
- ID: 421
- Canonical: https://0110.be/posts/TarsosDSP_Spectral_Peak_extraction

- Tags: [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

The TarsosDSP Java library for audio processing now contains a module for spectral peak extraction. It calculates a short time Fourier transform and subsequently finds the frequency bins with most energy present using a median filter. The frequency estimation for each identified bin is significantly improved by taking phase information into account. A method described in "Sethares et al. 2009 - Spectral Tools for Dynamic Tonality and Audio Morphing".

The noise floor, determined by the median filter, the spectral information itself and the estimated peak locations are returned for each FFT-frame. Below a visualization of a flute can be found. As expected, the peaks are harmonically spread over the complete spectrum up until the Nyquist frequency.


![Spectral peaks of a flute. The first 10 harmonic are detected up until the Nyquist frequency. ](https://0110.be/files/photos/421/spectral_peaks.png)

---

## [TarsosDSP Paper and Presentation at AES 53rd International conference on Semantic Audio](https://0110.be/posts/TarsosDSP_Paper_and_Presentation_at_AES_53rd_International_conference_on_Semantic_Audio.md)

- Published: 2013-12-24T00:00:00Z
- Updated: 2014-01-16T13:25:46Z
- Author: Joren
- ID: 411
- Canonical: https://0110.be/posts/TarsosDSP_Paper_and_Presentation_at_AES_53rd_International_conference_on_Semantic_Audio

- Tags: [Presentation](https://0110.be/tags/Presentation.md), [Research papers](https://0110.be/tags/Research%20papers.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [UGent](https://0110.be/tags/UGent.md)

TarsosDSP will be presented at the [AES 53rd International conference on Semantic Audio](http://www.aes.org/conferences/53/) in London . During the conference both a presentation and demonstration of the paper "*TarsosDSP, a Real-Time Audio Processing Framework in Java*":\[aes53_tarsos_dsp.pdf\], by Joren Six, Olmo Cornelis and Marc Leman, in *Proceedings of the 53rd AES Conference (AES 53rd)*, 2014. From their website:

> *Semantic Audio is concerned with content-based management of digital audio recordings. The rapid evolution of digital audio technologies, e.g. audio data compression and streaming, the availability of large audio libraries online and offline, and recent developments in content-based audio retrieval have significantly changed the way digital audio is created, processed, and consumed. New audio content can be produced at lower cost, while also large audio archives at libraries or record labels are opening to the public. Thus the sheer amount of available audio data grows more and more each day. Semantic analysis of audio resulting in high-level metadata descriptors such as musical chords and tempo, or the identification of speakers facilitate content-based management of audio recordings. Aside from audio retrieval and recommendation technologies, the semantics of audio signals are also becoming increasingly important, for instance, in object-based audio coding, as well as intelligent audio editing, and processing. Recent product releases already demonstrate this to a great extent, however, more innovative functionalities relying on semantic audio analysis and management are imminent. These functionalities may utilise, for instance, (informed) audio source separation, speaker segmentation and identification, structural music segmentation, or social and Semantic Web technologies, including ontologies and linked open data.*

> *This conference will give a broad overview of the state of the art and address many of the new scientific disciplines involved in this still-emerging field. Our purpose is to continue fostering this line of interdisciplinary research. This is reflected by the wide variety of invited speakers presenting at the conference.*

The paper presents TarsosDSP, a framework for real-time audio analysis and processing. Most libraries and frameworks offer either audio analysis and feature extraction or audio synthesis and processing. TarsosDSP is one of a only a few frameworks that offers both analysis, processing and feature extraction in real-time, a unique feature in the Java ecosystem. The framework contains practical audio processing algorithms, it can be extended easily, and has no external dependencies. Each algorithm is implemented as simple as possible thanks to a straightforward processing pipeline. TarsosDSP's features include a resampling algorithm, onset detectors, a number of pitch estimation algorithms, a time stretch algorithm, a pitch shifting algorithm, and an algorithm to calculate the Constant-Q. The framework also allows simple audio synthesis, some audio effects, and several filters. The Open Source framework is a valuable contribution to the MIR-Community and ideal fit for interactive MIR-applications on Android. The full paper can be downloaded "*TarsosDSP, a Real-Time Audio Processing Framework in Java*":\[aes53_tarsos_dsp.pdf\]

A BibTeX entry for the paper can be found below.

\`\`\`ruby\
\@inproceedings{six2014tarsosdsp,\
author = {Joren Six and Olmo Cornelis and Marc Leman},\
title = {{TarsosDSP, a Real-Time Audio Processing Framework in Java}},\
booktitle = {{Proceedings of the 53rd AES Conference (AES 53rd)}},\
year = 2014\
}\
\`\`\`


![AES53](https://0110.be/files/photos/411/AES53.jpg)

![Constant-Q](https://0110.be/files/photos/411/constantq-visualization-java.png)

![Flanger](https://0110.be/files/photos/411/Flanger_Effect_in_Java.png)

![Pitch Shifting](https://0110.be/files/photos/411/pitch-shift-in-java.png)

![Samping](https://0110.be/files/photos/411/_Extract___Modify_Samples.png)

- [aes53\_tarsos\_dsp.pdf](https://0110.be/files/attachments/411/aes53_tarsos_dsp.pdf)

---

## [Constant-Q Transform in Java with TarsosDSP](https://0110.be/posts/Constant-Q_Transform_in_Java_with_TarsosDSP.md)

- Published: 2013-10-09T00:00:00Z
- Updated: 2020-11-17T09:01:43Z
- Author: Joren
- ID: 363
- Canonical: https://0110.be/posts/Constant-Q_Transform_in_Java_with_TarsosDSP

- Tags: [Code](https://0110.be/tags/Code.md), [Computational musicology](https://0110.be/tags/Computational%20musicology.md), [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [Music Information Retrieval](https://0110.be/tags/Music%20Information%20Retrieval.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an implementation of a *Constant-Q Transform* (as of version 1.6). The Constant-Q transform does essentially the same thing as an FFT, but has the advantage that each octave has the same amount of bins. This makes the Constant-Q transform practical for applications processing music. If, for example, 12 bins per octave are chosen, these can correspond with the western musical scale.

Also included in the newest release (version 1.7) is a way to visualize the transform, or other musical features. The visualization implementation is done together with Thomas Stubbe.

The example application below shows the Constant-Q transform with an overlay of pitch estimations. The corresponding waveform is also shown.

<div align="center">
<a href="http://0110.be/releases/TarsosDSP/TarsosDSP-latest/TarsosDSP-latest-Examples/ConstantQ-latest.jar"><img src="https://0110.be/files/attachments/363/constantq-visualization-java.png" alt="Constant-Q transform in Java"/></a>

</div>
Find your oven fresh baked binaries at the [TarsosDSP Release Repository](http://tarsos.0110.be/releases/TarsosDSP/).\
The source code can be found at the [TarsosDSP GitHub repository](https://github.com/JorenSix/TarsosDSP).


- [constantq-visualization-java.png](https://0110.be/files/attachments/363/constantq-visualization-java.png)

---

## [Flanger Audio Effect in Java](https://0110.be/posts/Flanger_Audio_Effect_in_Java.md)

- Published: 2013-02-04T14:41:06Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 338
- Canonical: https://0110.be/posts/Flanger_Audio_Effect_in_Java

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an example demonstrating the [flanging audio effect](http://en.wikipedia.org/wiki/Flanging). Flanging, essentialy mixing the signal with a varying delay of itself, produces an interesting interference pattern.

<div align="center">
<a href="https://0110.be/releases/TarsosDSP/TarsosDSP-latest/TarsosDSP-latest-Examples/Flanging-latest.jar"><img src="https://0110.be/files/attachments/338/Flanger_Effect_in_Java.png" alt="Pitch estimation synthesizer"/></a>

</div>
The flanging example works on wav-files or on input from microphone. Try it yourself, download\
[Flanging.jar](https://0110.be/releases/TarsosDSP/TarsosDSP-latest/TarsosDSP-latest-Examples/Flanging-latest.jar), the executable jar file. Below you can check what flanging sounds like with various parameters.

<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F77772715">
</iframe>
The source code of the Java implementation can be found on the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP).


- [Flanger\_Effect\_in\_Java.png](https://0110.be/files/attachments/338/Flanger_Effect_in_Java.png)

---

## [TarsosDSP Pitch Estimation Synthesizer](https://0110.be/posts/TarsosDSP_Pitch_Estimation_Synthesizer.md)

- Published: 2012-12-19T15:07:10Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 359
- Canonical: https://0110.be/posts/TarsosDSP_Pitch_Estimation_Synthesizer

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an example showing how to synthesize pitch estimations. The goal of the example is to show which errors are made by different pitch detectors.

<div align="center">
<a href="https://0110.be/releases/TarsosDSP/TarsosDSP-latest/TarsosDSP-latest-Examples/Resynthesizer-latest.jar"><img src="https://0110.be/files/attachments/359/Pitch_Estimation_Synthesizer.png" alt="Pitch estimation synthesizer"/></a>

</div>
To test the application, download and execute the [Resynthesizer.jar](http://tarsos.0110.be/releases/TarsosDSP/TarsosDSP-latest/TarsosDSP-latest-Examples/Resynthesizer-latest.jar) file and load an audio file. For the moment only 44.1kHz mono wav is allowed. To hear what exactly it does, compare the following two audio fragments:

<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F71830992">
</iframe>
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F71831213">
</iframe>
There is also a command line interface, the following command does pitch tracking, and follows the envelope of `in.wav` and immediately plays it on the default audio device. If you want to save the audio, see the command line options. The "flute example":\[flute.wav\] is provided for your convenience.

<code>\
java -jar Resynthesizer-latest.jar in.wav\
</code>

     _______                       _____   _____ _____  
    |__   __|                     |  __ \ / ____|  __ \ 
       | | __ _ _ __ ___  ___  ___| |  | | (___ | |__) |
       | |/ _` | '__/ __|/ _ \/ __| |  | |\___ \|  ___/ 
       | | (_| | |  \__ \ (_) \__ \ |__| |____) | |     
       |_|\__,_|_|  |___/\___/|___/_____/|_____/|_|     

    ----------------------------------------------------
    Name:
        TarsosDSP resynthesizer
    ----------------------------------------------------
    Synopsis:
        java -jar CommandLineResynthesizer.jar [--detector DETECTOR] [--output out.wav] [--combined combined.wav] input.wav
    ----------------------------------------------------
    Description:
        Extracts pitch and loudnes from audio and resynthesises the audio with that information.
        The result is either played back our written in an output file. 
        There is als an option to combine source and synthezized material
        in the left and right channels of a stereo audio file.

        input.wav       a readable wav file.

        --output out.wav        a writable file.

        --combined combined.wav     a writable output file. One channel original, other synthesized.
        --detector DETECTOR defaults to FFT_YIN or one of these:
                    YIN
                    MPM
                    FFT_YIN
                    DYNAMIC_WAVELET
                    AMDF

The source code of the Java implementation of the synthesizer can be found on the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP).


- [Pitch\_Estimation\_Synthesizer.png](https://0110.be/files/attachments/359/Pitch_Estimation_Synthesizer.png)

- [flute.wav](https://0110.be/files/attachments/359/flute.wav)

---

## [Phase Vocoding: Time Stretching and Pitch Shifting with TarsosDSP Java](https://0110.be/posts/Phase_Vocoding%3A_Time_Stretching_and_Pitch_Shifting_with_TarsosDSP_Java.md)

- Published: 2012-12-13T00:00:00Z
- Updated: 2020-11-17T09:02:35Z
- Author: Joren
- ID: 355
- Canonical: https://0110.be/posts/Phase_Vocoding%3A_Time_Stretching_and_Pitch_Shifting_with_TarsosDSP_Java

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [WSOLA](https://0110.be/tags/WSOLA.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an implementation of a *pitch shifting algorithm* (as of version 1.4) and a time stretching algorithm. Combined, the two can be used for something like [phase vocoding](http://en.wikipedia.org/wiki/Phase_vocoder). With a phase vocoder you can load an audio snippet, change the pitch and duration and e.g. create a library of snippets. E.g. by recording one piano key stroke, it is possible to generate two octaves of samples of different lengths, and use those in stead of synthesized samples. The following example application shows exactly that, implemented in the java programming language.

The example application below shows how to pitch shift and time stretch a sample to create a sample library with the TarsosDSP library.

<div align="center">
<a href=/releases/TarsosDSP/TarsosDSP-latest/TarsosDSP-latest-Examples/SampleExtractor-latest.jar"><img src="https://0110.be/files/attachments/355/_Extract___Modify_Samples.png" alt="Pitch shifting in Java"/></a>

</div>
Find your oven fresh baked binaries at the [TarsosDSP Release Repository](https://0110.be/releases/TarsosDSP/).


- [\_Extract\_\_\_Modify\_Samples.png](https://0110.be/files/attachments/355/_Extract___Modify_Samples.png)

---

## [Pitch Shifting - Implementation in Pure Java with Resampling and Time Stretching](https://0110.be/posts/Pitch_Shifting_-_Implementation_in_Pure_Java_with_Resampling_and_Time_Stretching.md)

- Published: 2012-11-05T00:00:00Z
- Updated: 2020-11-17T09:07:53Z
- Author: Joren
- ID: 370
- Canonical: https://0110.be/posts/Pitch_Shifting_-_Implementation_in_Pure_Java_with_Resampling_and_Time_Stretching

- Tags: [Code](https://0110.be/tags/Code.md), [Command Line Application](https://0110.be/tags/Command%20Line%20Application.md), [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [WSOLA](https://0110.be/tags/WSOLA.md), [featured](https://0110.be/tags/featured.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an implementation of a *pitch shifting algorithm* (as of version 1.4). The goal of pitch shifting is to change the pitch of a piece of audio without affecting the duration. The algorithm implemented is a combination of resampling and time stretching. Resampling changes the pitch of the audio, but affects the total duration. Consecutively, the duration of the audio is stretched to the original (without affecting pitch) with time stretching. The result is very similar to [phase vocoding](http://en.wikipedia.org/wiki/Phase_vocoder).

The example application below shows how to pitch shift input from the microphone in real-time, or pitch shift a recorded track with the TarsosDSP library.

<div align="center">
<a href="https://0110.be/releases/TarsosDSP/TarsosDSP-1.4/TarsosDSP-1.4-Examples/PitchShift-1.4.jar"><img src="https://0110.be/files/attachments/370/pitch-shift-in-java.png" alt="Pitch shifting in Java"/></a>

</div>
To test the application, download and execute the [PitchShift.jar](https://0110.be/releases/TarsosDSP/TarsosDSP-latest/TarsosDSP-latest-Examples/PitchShift-latest.jar) file and load an audio file. For the moment only 44.1kHz mono wav is allowed. To get started you can try "this piece of audio":\[08.\_Ladrang_Kandamanyura_10s-20s.wav\].

There is also a command line interface, the following command lowers the pitch of `in.wav` by two semitones.

    java -jar in.wav out.wav -200

    ----------------------------------------------------
     _______                       _____   _____ _____  
    |__   __|                     |  __ \ / ____|  __ \ 
       | | __ _ _ __ ___  ___  ___| |  | | (___ | |__) |
       | |/ _` | '__/ __|/ _ \/ __| |  | |\___ \|  ___/ 
       | | (_| | |  \__ \ (_) \__ \ |__| |____) | |     
       |_|\__,_|_|  |___/\___/|___/_____/|_____/|_|     

    ----------------------------------------------------
    Name:
        TarsosDSP Pitch shifting utility.
    ----------------------------------------------------
    Synopsis:
        java -jar PitchShift.jar source.wav target.wav cents
    ----------------------------------------------------
    Description:
        Change the play back speed of audio without changing the pitch.

            source.wav  A readable, mono wav file.
            target.wav  Target location for the pitch shifted file.
            cents       Pitch shifting in cents: 100 means one semitone up, 
                    -100 one down, 0 is no change. 1200 is one octave up.

The resampling feature was implemented with libresample4j by Laszlo Systems. libresample4j is a Java port of Dominic Mazzoni's libresample 0.1.3, which is in turn based on Julius Smith's Resample 1.7 library.


- [pitch-shift-in-java.png](https://0110.be/files/attachments/370/pitch-shift-in-java.png)

- [08.\_Ladrang\_Kandamanyura\_10s-20s.wav](https://0110.be/files/attachments/370/08._Ladrang_Kandamanyura_10s-20s.wav)

---

## [TarsosDSP Release 1.2](https://0110.be/posts/TarsosDSP_Release_1.2.md)

- Published: 2012-06-05T13:26:22Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 336
- Canonical: https://0110.be/posts/TarsosDSP_Release_1.2

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

Today a new version of the TarsosDSP library was released. TarsosDSP is a small library to do audio processing in Java. It features two new pitch detectors. An AMDF (Average Magnitude Difference Function) pitch detector, contributed by [Eder Souza](http://ederwander.wordpress.com/) of Brazil and a faster implementation of YIN kindly provided by [Matthias Mauch](http://matthiasmauch.net/) of Queen Mary University, London.

<div align="center">
[![Pitch Detector in Java](https://0110.be/files/attachments/336/PitchDetector.png "Pitch Detector in Java")](https://0110.be/releases/TarsosDSP/TarsosDSP-1.2/TarsosDSP-1.2-Examples/PitchDetector-1.2.jar)

</div>
Find your oven fresh baked binaries at the [TarsosDSP Release Repository](http://tarsos.0110.be/releases/TarsosDSP/).


- [PitchDetector.png](https://0110.be/files/attachments/336/PitchDetector.png)

---

## [TarsosDSP Release 1.0](https://0110.be/posts/TarsosDSP_Release_1.0.md)

- Published: 2012-04-24T14:25:32Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 352
- Canonical: https://0110.be/posts/TarsosDSP_Release_1.0

- Tags: [Code](https://0110.be/tags/Code.md), [Command Line Application](https://0110.be/tags/Command%20Line%20Application.md), [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [Music Information Retrieval](https://0110.be/tags/Music%20Information%20Retrieval.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [WSOLA](https://0110.be/tags/WSOLA.md), [featured](https://0110.be/tags/featured.md)

After about a year of development and several revisions TarsosDSP has enough features and is stable enough to slap the 1.0 tag onto it. A 'read me', manual, API documentation, source and binaries can be found on the [TarsosDSP release directory](http://tarsos.0110.be/releases/TarsosDSP/). The source is present in the\
What follows below is the information that can be found in the read me file:

<p>
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 <acronym title="Dual tone multi frequency"><span class="caps">DTMF</span></acronym> decoding algorithm and a time stretch algorithm (<span class="caps">WSOLA</span>).

</p>
<p>
Its aim is to provide a simple interface to some audio (signal) processing algorithms implemented in pure <span class="caps">JAVA</span>. Some <a href="http://tarsos.0110.be/tag/TarsosDSP">TarsosDSP example applications</a> are available.

</p>
<p>
The following example filters a band of frequencies of an input file <code>testFile</code>. It keeps the frequencies form <code>startFrequency</code> to <code>stopFrequency</code>.

</p>
    <code>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();
    </code>

<h3>
Quickly Getting Started with TarsosDSP

</h3>
<p>
Head over to the <a href="http://tarsos.0110.be/releases/TarsosDSP/">TarsosDSP release repository</a> and download the latest <a href="http://tarsos.0110.be/releases/TarsosDSP/TarsosDSP-1.0.jar">TarsosDSP library</a>. To get up to speed quickly, check the <a href="http://tarsos.0110.be/releases/TarsosDSP/TarsosDSP-1.0-Examples/">TarsosDSP Example applications</a> for inspiration and consult the <a href="http://tarsos.0110.be/releases/TarsosDSP/TarsosDSP-1.0-Documentation/"><span class="caps">API</span> documentation</a>. If you, for some reason, want to build from source, you need <a href="http://ant.apache.org/">Apache Ant</a> and <a href="http://git-scm.com/">git</a> installed on your system. The following commands fetch the source and build the library and example jars: <br />

    <code>git clone https://JorenSix@github.com/JorenSix/TarsosDSP.git
    cd TarsosDSP/build
    ant tarsos_dsp_library #Builds the core TarsosDSP library
    ant build_examples #Builds all the TarsosDSP examples
    ant javadoc #Creates the documentation in TarsosDSP/doc
    </code>

<br />\
When everything runs correctly you should be able to run all example applications and have the latest version of the TarsosDSP library for inclusion in your projects. Also the Javadoc documentation for the <span class="caps">API</span> should be available in TarsosDSP/doc. Drop me a line if you use TarsosDSP in your project. Always nice to hear how this software is used.

</p>
<h3>
Source Code Organization and Examples of TarsosDSP

</h3>
<p>
The source tree is divided in three directories:

</p>
<ul>
<li>
<code>src</code> contains the source files of the core <span class="caps">DSP</span> libraries.

</li>
<li>
<code>test</code> contains unit tests for some of the <span class="caps">DSP</span> functionality.

</li>
<li>
<code>build</code> contains <span class="caps">ANT</span> build files. Either to build Java documentation or runnable <span class="caps">JAR</span>-files for the example applications.

</li>
<li>
<code>examples</code> contains a couple of example applications with a Java Swing user interface:

<ul>
<li>
<a href="http://tarsos.0110.be/artikels/lees/TarsosDSP%253A_a_small_JAVA_audio_processing_library">SoundDetector</a> show how you loudness calculations can be done. When input sound is over a defined limit an event is fired.

</li>
<li>
<a href="http://tarsos.0110.be/artikels/lees/TarsosDSP%253A_a_small_JAVA_audio_processing_library">PitchDetector</a> this demo application shows real-time pitch detection. When pitch is detected the hertz value is printed together with a probability.

</li>
<li>
<a href="http://tarsos.0110.be/artikels/lees/TarsosDSP%253A_a_small_JAVA_audio_processing_library">PercussionDetector</a> 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.

</li>
<li>
<a href="http://tarsos.0110.be/artikels/lees/TarsosDSP_sample_application%253A_Utter_Asterisk">UtterAsterisk</a> a game with the goal to sing as close to a melody a possible. Technically it shows real-time pitch detection with <span class="caps">YIN</span> or <span class="caps">MPM</span>.

</li>
<li>
<a href="http://tarsos.0110.be/artikels/lees/Spectrogram_in_Java_with_TarsosDSP">Spectrogram in Java</a> shows a spectrogram and detected pitch, either live or from an audio file. It is interesting to see which frequencies are picked as fundamentals.

</li>
<li>
<a href="http://tarsos.0110.be/artikels/lees/Dual-Tone_Multi-Frequency_%2528DTMF%2529_Decoding_with_the_Goertzel_Algorithm_in_Java">Goertzel <acronym title="Dual tone multi frequency"><span class="caps">DTMF</span></acronym> decoding</a> an implementation of the Goertzel Algorithm. A fancy user interface shows what goes on under the hood.

</li>
<li>
<a href="http://tarsos.0110.be/artikels/lees/Audio_Time_Stretching_-_Implementation_in_Pure_Java_Using_WSOLA">Audio Time Stretching -- Implementation in Pure Java Using <span class="caps">WSOLA</span></a> an implementation of a time stretching algorithm. <acronym title="Waveform Similarity Overlap Add"><span class="caps">WSOLA</span></acronym> makes it possible to change the play back speed of audio without changing the pitch. The play back speed can be changed at any moment, even when there is audio playing.

</li>
</ul>
</li>
</ul>


---

## [Oscilloscope in TarsosDSP](https://0110.be/posts/Oscilloscope_in_TarsosDSP.md)

- Published: 2012-03-09T15:21:30Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 330
- Canonical: https://0110.be/posts/Oscilloscope_in_TarsosDSP

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an implementation of an oscilloscope.

<div align="center">
"![Oscilloscope in Java](https://0110.be/files/attachments/330/oscilloscope.png "Oscilloscope in Java")":\[OscilloscopeExample.jar\]

</div>
The source code of the Java implementation can be found on the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP/). That is all.


---

## [Echo or Delay Audio Effect in Java With TarsosDSP](https://0110.be/posts/Echo_or_Delay_Audio_Effect_in_Java_With_TarsosDSP.md)

- Published: 2012-02-23T15:33:11Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 398
- Canonical: https://0110.be/posts/Echo_or_Delay_Audio_Effect_in_Java_With_TarsosDSP

- Tags: [Code](https://0110.be/tags/Code.md), [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an implementation of an audio echo effect. An echo effect is very simple to implement digitally and can serve as a good example of a DSP operation.

<div align="center">
"![Echo or delay effect in Java](https://0110.be/files/attachments/398/echo_or_delay_effect.png "Echo or delay effect in Java")":\[Delay.jar\]

</div>
The implementation of the effect can be seen below. As can be seen, to achieve an echo one simply needs to mix the current sample `i` with a delayed sample present in `echoBuffer` with a certain decay factor. The length of the buffer and the decay are the defining parameters for the sound of the echo. To fill the echo buffer the current sample is stored (line 4). Looping through the echo buffer is done by incrementing the position pointer and resetting it at the correct time (lines 6-9).

\`\`\`java\
//output is the input added with the decayed echo\
audioFloatBuffer\[i\] = audioFloatBuffer\[i\] + echoBuffer\[position\] \* decay;\
//store the sample in the buffer;\
echoBuffer\[position\] = audioFloatBuffer\[i\];\
//increment the echo buffer position\
position;\
//loop in the echo buffer\
if(position == echoBuffer.length)\
position = 0;\
\`\`\`

To test the application, download and execute the "Delay.jar":\[Delay.jar\] file and start singing in a microphone.

The source code of the Java implementation can be found on the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP/).


![](https://0110.be/files/photos/398/echo_or_delay_effect.png)

- [Delay.jar](https://0110.be/files/attachments/398/Delay.jar)

- [echo\_or\_delay\_effect.png](https://0110.be/files/attachments/398/echo_or_delay_effect.png)

---

## [Spectrogram in Java with TarsosDSP](https://0110.be/posts/Spectrogram_in_Java_with_TarsosDSP.md)

- Published: 2012-02-14T14:31:04Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 384
- Canonical: https://0110.be/posts/Spectrogram_in_Java_with_TarsosDSP

- Tags: [Code](https://0110.be/tags/Code.md), [Computational musicology](https://0110.be/tags/Computational%20musicology.md), [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

This is post presents a better version of the [spectrogram implementation](https://0110.be/artikels/lees/Tarsos_Spectrogram). Now it is included as an example in TarsosDSP, a small java audio processing library. The application show a live spectrogram, calculated using an FFT and the detected fundamental frequency (in red).

<div align="center">
<a href="https://0110.be/files/attachments/384/Spectrogram.jar"><img src="https://0110.be/files/attachments/384/spectrogram.png" alt="Spectrogram and pitch detection in Java"/></a>

</div>
To test the application, download and execute the "Spectrogram.jar":\[Spectrogram.jar\] file and start singing in a microphone.

There is also a command line interface, the following command shows the spectrum for `in.wav`:

<code>\
java -jar Spectrogram.jar in.wav\
</code>

The source code of the Java implementation can be found on the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP/).


![](https://0110.be/files/photos/384/spectrogram.png)

- [Spectrogram.jar](https://0110.be/files/attachments/384/Spectrogram.jar)

- [spectrogram.png](https://0110.be/files/attachments/384/spectrogram.png)

---

## [Audio Time Stretching - Implementation in Pure Java Using WSOLA](https://0110.be/posts/Audio_Time_Stretching_-_Implementation_in_Pure_Java_Using_WSOLA.md)

- Published: 2012-02-06T14:52:34Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 372
- Canonical: https://0110.be/posts/Audio_Time_Stretching_-_Implementation_in_Pure_Java_Using_WSOLA

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [Tarsos](https://0110.be/tags/Tarsos.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [WSOLA](https://0110.be/tags/WSOLA.md)

The DSP library for Taros, aptly named TarsosDSP, now includes an implementation of a time stretching algorithm. The goal of time stretching is to change the duration of a piece of audio without affecting the pitch. The algorithm implemented is described in [An Overlap-add Technique Based On Waveform Similarity (WSOLA) for High Quality Time-Scale Modification of Speech](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.202.5460&rep=rep1&type=pdf).

<div align="center">
<a href="https://0110.be/files/attachments/372/TimeStretch.jar"><img src="https://0110.be/files/attachments/372/time_stretching_in_java.png" alt="Time Stretching (WSOLA) in Java"/></a>

</div>
To test the application, download and execute the "WSOLA jar":\[TimeStretch.jar\] file and load an audio file. For the moment only 44.1kHz mono wav is allowed. To get started you can try "this piece of audio":\[08.\_Ladrang_Kandamanyura_10s-20s.wav\].

There is also a command line interface, the following command doubles the speed of `in.wav`:

<code>\
java -jar TimeStretch.jar in.wav out.wav 2.0\
</code>

     _______                       _____   _____ _____  
    |__   __|                     |  __ \ / ____|  __ \ 
       | | __ _ _ __ ___  ___  ___| |  | | (___ | |__) |
       | |/ _` | '__/ __|/ _ \/ __| |  | |\___ \|  ___/ 
       | | (_| | |  \__ \ (_) \__ \ |__| |____) | |     
       |_|\__,_|_|  |___/\___/|___/_____/|_____/|_|     

    ----------------------------------------------------
    Name:
        TarsosDSP Time stretch utility.
    ----------------------------------------------------
    Synopsis:
        java -jar TimeStretch.jar source.wav target.wav factor
    ----------------------------------------------------
    Description:
        Change the play back speed of audio without changing the pitch.

            source.wav  A readable, mono wav file.
            target.wav  Target location for the time stretched file.
            factor      Time stretching factor: 2.0 means double the length, 0.5 half. 1.0 is no change.

The source code of the Java implementation of WSOLA can be found on the [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP/blob/master/src/be/hogent/tarsos/dsp/filters/WaveformSimilarityBasedOverlapAdd.java).


- [time\_stretching\_in\_java.png](https://0110.be/files/attachments/372/time_stretching_in_java.png)

- [08.\_Ladrang\_Kandamanyura\_10s-20s.wav](https://0110.be/files/attachments/372/08._Ladrang_Kandamanyura_10s-20s.wav)

- [TimeStretch.jar](https://0110.be/files/attachments/372/TimeStretch.jar)

---

## [TarsosDSP sample application: Utter Asterisk](https://0110.be/posts/TarsosDSP_sample_application%3A_Utter_Asterisk.md)

- Published: 2011-12-15T14:30:42Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 404
- Canonical: https://0110.be/posts/TarsosDSP_sample_application%3A_Utter_Asterisk

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

<a href="https://0110.be/files/attachments/404/UtterAsterisk.jar" title="Download Utter Asterisk"><img src="https://0110.be/photo/cons/250/utter_asterisk.png" alt="Uttter Asterisk" style="float:right" width="210"></a>The DSP library of Tarsos, aptly named TarsosDSP, contains an implementation of a game that bares some resemblance to SingStar. It is called UtterAsterisk. It is meant to be a technical demonstration showing real-time pitch detection in pure java using a [YIN](http://recherche.ircam.fr/equipes/pcm/cheveign/ps/2002_JASA_YIN_proof.pdf) -implementation.

"Download Utter Asterisk":\[UtterAsterisk.jar\] and try to sing (utter) as close to the melody as possible. The [souce code for Utter Asterisk](https://github.com/JorenSix/TarsosDSP) is available on github.


![](https://0110.be/files/photos/404/utter_asterisk.png)

- [UtterAsterisk.jar](https://0110.be/files/attachments/404/UtterAsterisk.jar)

---

## [TarsosDSP used in jAM - Java Automatic Music Transcription](https://0110.be/posts/TarsosDSP_used_in_jAM_-_Java_Automatic_Music_Transcription.md)

- Published: 2011-12-12T09:13:14Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 399
- Canonical: https://0110.be/posts/TarsosDSP_used_in_jAM_-_Java_Automatic_Music_Transcription

- Tags: [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

<img src="https://0110.be/files/attachments/399/jAMlogo.png" width="40" alt="jAM logo" style="float:right">TarsosDSP, a small Java DSP library, has been used in a bachelor thesis: [Entwicklung eines Systems zur automatischen Notentranskription von monophonischem Audiomaterial](http://saeft.com/jAM/assets/Bachelorarbeit.pdf) by Michael Wager.

The goal of the thesis was to develop an automatic transcription system for monophonic music. You can download the latest version of [jAM - Java Automatic Music Transcription](http://saeft.com/jAM/index.php/index/download).

If you want to use TarsosDSP, please consult the [TarsosDSP page on github](https://github.com/JorenSix/TarsosDSP) or read [more about TarsosDSP](https://0110.be/tag/TarsosDSP) here.


---

## [Dual-Tone Multi-Frequency (DTMF) Decoding with the Goertzel Algorithm in Java](https://0110.be/posts/Dual-Tone_Multi-Frequency_%28DTMF%29_Decoding_with_the_Goertzel_Algorithm_in_Java.md)

- Published: 2011-09-27T09:07:26Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 343
- Canonical: https://0110.be/posts/Dual-Tone_Multi-Frequency_%28DTMF%29_Decoding_with_the_Goertzel_Algorithm_in_Java

- Tags: [Code](https://0110.be/tags/Code.md), [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md)

<a href="https://0110.be/files/attachments/343/GoertzelDTMF.jar"><img style="float:right;margin-left:5px" src="https://0110.be/files/attachments/343/goertzel_DTMF_java_7.png" alt="DTMF Goertzel in JAVA"/></a>The DSP library of Tarsos, aptly named TarsosDSP, now contains an implementation of the Goertzel Algorithm. It is implemented using pure Java.

The [Goertzel algorithm](http://en.wikipedia.org/wiki/Goertzel_algorithm) can be used to detect if one or more predefined frequencies are present in a signal and it does this very efficiently. One of the classic applications of the Goertzel algorithm is decoding the tones generated on by touch tone telephones. These use [DTMF (Dual tone multi frequency)-signaling](http://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling).

To make the algorithm visually appealing a Java Swing interface has been created(visible right). You can try this application by running the "Goertzel DTMF Jar-file":\[GoertzelDTMF.jar\]. The souce code is included in the jar and is avaliable as a separate "zip file":\[GoertzelDTMF_src.zip\]. The [TarsosDSP github page](https://github.com/JorenSix/TarsosDSP) also contains the source for the [Goertzel algorithm Java implementation](https://github.com/JorenSix/TarsosDSP/blob/master/src/be/hogent/tarsos/dsp/pitch/Goertzel.java).


![DTMF detection of 9](https://0110.be/files/photos/343/goertzel_DTMF_java_9.png)

![DTMF detection of 2](https://0110.be/files/photos/343/goertzel_DTMF_java_2.png)

- [goertzel\_DTMF\_java\_7.png](https://0110.be/files/attachments/343/goertzel_DTMF_java_7.png)

- [GoertzelDTMF.jar](https://0110.be/files/attachments/343/GoertzelDTMF.jar)

- [GoertzelDTMF\_src.zip](https://0110.be/files/attachments/343/GoertzelDTMF_src.zip)

---

## [TarsosDSP: a small JAVA audio processing library](https://0110.be/posts/TarsosDSP%3A_a_small_JAVA_audio_processing_library.md)

- Published: 2011-03-25T15:58:59Z
- Updated: 2013-12-05T18:19:15Z
- Author: Joren
- ID: 392
- Canonical: https://0110.be/posts/TarsosDSP%3A_a_small_JAVA_audio_processing_library

- Tags: [Code](https://0110.be/tags/Code.md), [HoGent](https://0110.be/tags/HoGent.md), [Java](https://0110.be/tags/Java.md), [Tarsos](https://0110.be/tags/Tarsos.md), [TarsosDSP](https://0110.be/tags/TarsosDSP.md), [featured](https://0110.be/tags/featured.md)

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.

Its aim is to provide a simple interface to some audio (signal) processing algorithms implemented in JAVA.

To make some of the possibilities clear I coded some examples.

-   "TarsosDSP UtterAsterisk":\[UtterAsterisk.jar\] a game that shows real-time pitch detection with YIN.

-   "TarsosDSP Sound Detector":\[SoundDetector.jar\] is simply to show how to react when (loud) sound is available.

-   "TarsosDSP Percussion Detector":\[PercussionDetector.jar\] is capable of detecting percussion onsets using the method described [here](http://arrow.dit.ie/cgi/viewcontent.cgi?article=1018&context=argcon). It plays a sound from [freesound.org](http://freesound.org) when percussion is detected.

The [source code of TarsosDSP](https://github.com/JorenSix/TarsosDSP) is available on github.

### Presentation at Newline

Saturday the 25th of March TarsosDSP was presented at [Newline](http://0x20.be/Newline/Schedule), a small conference organized by [whitespace](http://0x20.be). Here you can download "the slides I used to present TarsosDSP":\[tarsosDSP_presentation.pdf\], I also created "an introductory text on sound and Java":\[sound_and_java.pdf\].

<object style="height: 390px; width: 640px">
<param name="movie" value="http://www.youtube.com/v/_abJ00qHkXI?version=3"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/_abJ00qHkXI?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"></object>


![Percussion detection](https://0110.be/files/photos/392/Percussion_Detector.png)

![UtterAsterisk](https://0110.be/files/photos/392/UtterAsterisk.png)

![Sound Detector](https://0110.be/files/photos/392/SoundDetector.png)

- [PitchDetector.jar](https://0110.be/files/attachments/392/PitchDetector.jar)

- [PercussionDetector.jar](https://0110.be/files/attachments/392/PercussionDetector.jar)

- [tarsosDSP\_presentation.pdf](https://0110.be/files/attachments/392/tarsosDSP_presentation.pdf)

- [sound\_and\_java.pdf](https://0110.be/files/attachments/392/sound_and_java.pdf)

- [UtterAsterisk.jar](https://0110.be/files/attachments/392/UtterAsterisk.jar)

- [SoundDetector.jar](https://0110.be/files/attachments/392/SoundDetector.jar)

---
