---
title: Spectrogram in Java with TarsosDSP
canonical: https://0110.be/posts/Spectrogram_in_Java_with_TarsosDSP
markdown_url: https://0110.be/posts/Spectrogram_in_Java_with_TarsosDSP.md
id: 384
published_at: '2012-02-14T14:31:04Z'
updated_at: '2013-12-05T18:19:15Z'
author: Joren
tags:
- name: Code
  markdown_url: https://0110.be/tags/Code.md
- name: Computational musicology
  markdown_url: https://0110.be/tags/Computational%20musicology.md
- name: HoGent
  markdown_url: https://0110.be/tags/HoGent.md
- name: Java
  markdown_url: https://0110.be/tags/Java.md
- name: TarsosDSP
  markdown_url: https://0110.be/tags/TarsosDSP.md
---

# Spectrogram in Java with TarsosDSP

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)
