Sound of lena

The idea of making sound from images was there from quite a long time ago.

For instance, using a picture of probably the most famouse lady in image processing as input:


to get a sound with this spectrogram:


No idea what human beings in stone ages were thinking, but in the ages of computers, Iannis Xenakis was already thinking about the use of images as input data for making audio, in 1970s, in a system called UPIC. So far I know, couple commercial software exist for editing sound data in frequency domain via graphical user interface. Like metasynth and photosounder, to name a few. One use of this technique I know is in Windowlicker, by Aphex Twin.

There is a nice article which describing about making spectrogram of image with perl, it inspired me to do it with haskell. The code used to convert above image was implemented in haskell, with repa, fftw, and libsndfile.

Source code of executable, named spectrofy, could be found here. Couple packages that I packed as repa interface are also available. The BMP image of lena was converted to wav audio, and then spectrogram was created with sox:

$ spectrofy fft -f512 lena.bmp lena.wav
$ sox lena.wav -n spectrogram -x 256 -y 257 -Z -48 -z 45

The spectrogram shown above was created with above commands. Not with photoshop.

Update: November 21, 2013 - modified links to images and spectrogram article.

TAGGED: haskell, sound, image, repa