To follow this guide you'll want to download the following code and unzip it somewhere convenient:
The code includes:
  • spectrum, a folder with a Teensyduino sketch for the spectrum analyzer.
  • toneinput, a folder with a Teensyduino sketch for tone detection.
  •, a python script to display a real-time spectrogram from the hardware.
  •, the user interface code used by
  •, an abstract class for extending the spectrogram to other devices in the future.
  •, an implementation of to interface with the hardware over a serial port.


To run the sketches you'll want to make sure you have Teensyduino installed. Follow these instructions to download and install Teensyduino.

To run the Spectrogram python script you'll need python 2.7 and a few libraries installed:
  • matplotlib, a library for plotting data.
  • NumPy, a library for numeric computing.
  • PySide, a python binding to the Qt user interface library.
  • pySerial, a library for serial code IO.
You can install python and these dependencies manually, however be warned the installation on Windows and Mac OSX is not easy. As an alternative you can download a pre-built distribution of python and the necessary scientific computing libraries. The Anaconda distribution by Continuum Analytics is what I recommend--it's free, includes the necessary dependencies, and can install side by side with existing python installations easily. Canopy by Enthought is another popular python scientific computing distribution too.

Assuming you installed a distribution such as Anaconda, you'll want to install the pySerial library (which is not included in the distribution) by executing the following command (be sure the anaconda /bin directory is in your path before executing):

pip install pyserial

Continue on to learn about the applying the Fourier transform to build an audio spectrum analyzer.

This guide was first published on Oct 03, 2013. It was last updated on Oct 03, 2013.

This page (Software) was last updated on Oct 02, 2013.

Text editor powered by tinymce.