DSP Experiments

I spent the final days of the summer exploring the Fourier transform with Nicolas Avrutin by writing an image <-> audio converter in Python/Numpy. This was more an exercise in learning Numpy, but the result is pretty cool:

This is the spectrograph of an 18 second audio file generated by our script. The ghostly vertical lines are due to interpolation issues, translating an image sampled at a certain rate into an image with far fewer pixels columns than necessary. Color represents intensity of the sound.

We implemented a full color version by using a three channel WAV file (usually used for surround sound or secondary language purposes). We had to write a custom spectrograph generator, as SOX will not combine the channels into a color image. Here’s SOX’s spectrograph:

And our own spectrograph:

Work has been halted on this project while Nick and I deal with school, but this could be used to embed a faint image into music.

ORM Models for restful APIs

I wrote a nifty class which wraps URLLib behind an interface for RESTful web services. The result is a set of one-liners that can be used to import data from compatible APIs.

The goal of this project is to easily import and process data from disparate APIs without needing to read thousands of pages of poorly written documentation. Just import the models you need and hit the ground running.

Think of it as Yahoo Pipes, but local and in Python instead of a graphical programming language.

Subversion Repository Index Page

Back when I was working on my FRC robotics team’s website, I wrote a simple page to display all of the subversion repositories related to my team. Realizing that there were no existing simple subversion repository index page generators, I decided to make one with human readable code and post it here.

See it in action!   http://svn.jperr.com

Download svnindex.py

The code was developed and tested using Python2.6, but I see no reason why it shouldn’t work in Python3.0. Likewise, I’ve developed and tested this using UNIX based machines (Mac 10.6 and Debian Linux), but it should work under Windows. The script requires the command line “svn” client to be installed and accessible by the user under which Python runs, and you must have the standard python “time” and “commands” modules installed. 99.9% of Python installations will have them pre-installed.

All you need to do to get svnindex.py running on your site:

  • Download svnindex.py (link above)
  • Modify the settings at the top of the file
  • Set up a daily cronjob to run the generation script. Something like `python /path/to/svnindex.py` works just fine.