Orlando, Florida, USA
Pipe Down
StoreTags: hacking, noise, linux
Author: mrpanda on August 23 2006
Viewed 1722 times. 6 people liked this blog. You can rate it below if you haven't already.
People who enjoyed reading this: bodo, race4prize, Roshi, energygiant, flies, crazyshadow
--> As I was sitting in my local chain bookstore a month or so ago, while reading an issue Linux User magazine (number 62 exactly), I happened across an interesting article on the use of common GNU tools for artistic purposes. The part that really sparked my interest though was the use of the cat command to output binary data which could then be piped directly to the sound card. Like this for example:

cat image.jpg > /dev/dsp

That would simply output image.jpg as a mess of text to stdout and then reroute it to the soundcard, which as you can assume, makes a lot of nasty sounds. This is too fun and useful to just pass off though, so through a little trial and error, came to some of the following conclusions.

All data, even though it may seem random to us, has patterns. The question is how can we accentuate these patterns and make them stand out when sent to the soundcard. My conclusion (though i'm sure there are thousands of others) was to make very simple patterned image files. I started by opening up a simple bitmap editor, like xpaint. You could use GIMP, but it's probably overkill. The first image I made was a simple rectangle divided vertically down the middle, with the left side white and the right side black. I saved it to PNG format, but anything lossless (png, bmp, high quality jpeg) should be fine. You want the image quality to be as fine as possible because when you send it to standard out, you want the data for each pixel to be exactly the same with regards to color. If the image is compressed, while the colors may looks similar to us, the machine will recognize each pixel as being a little different, and thus the output will be much less clean. The same goes for a high quality image with a lot of different colors.

Anyway, when you cat the image it will read over each pixel horozontally, down a line, and then over again, like reading a book. This is how you can control the speed and, to a certain degree, oscillation of the sounds made. The image I discussed above makes a ringing sound like a cordless phone. If you make the canvas size shorter vertically, the sound will be more abrupt.

In another trial I used horizontal gray and black bars. Color seems to effect pitch, but I'm not exactly certain how yet. The horizontal bars make more of a buzzing/drilling sound. A pixelized vertical gradient from black to white starts with harsh noise and morphs into a high pitch ring.

In order to make this more practical for performances, one can easily make a simple looping shell script which can also include other common commands such as tac, sleep, sed, just to name a few. Ever wanted to hear the internet? Pipe tcpdump to the soundcard.

This brings me to my most recent experiment - using the program hasciicam which takes video data from /dev/video (a standard webcam) and converts it ascii with the help of aalib. In live mode, which streams the output directly to the console, you can then pipe to the soundcard and use the webcam in a theremin-esque fashion, moving it around light sources, covering it with your hands, etc. A command like this should do the trick:

hasciicam -m live > /dev/dsp

You could also attempt to process the data any way you like inbetween the command line and the soundcard. I get the feeling that an extremely contrasted video stream would sound even more interesting than plain ascii. This is just a few of my experiments as examples to get you started, but I'm sure someone with a little more experience could really do some amazing things. Also, I'm not sure how the file system on OSX works, but if you can find the device location of the soundcard, you can probably use it in a similar fashion.

"You've got pluggability" article link
hasciicam link
tcpdump link
aalib link
Read mrpanda's other blogs.mrpanda's Recent Blogs
Comments

cool. i've used several progs for windows that'll let me play image files as sound, but all i ever get is white noise and i never really worked on it. makes me think about trying some more.

Old CD players would try to play CD roms. The sounds was pretty rad in a Powernoise sorta way.

i got some 'good' results converting a picture to a wave file and then time-stretching it really a lot. the file is online but the server seems to be down atm. it ended up being almost harmonic, with fifths and 9ths and stuff appearing in it. very noisey tho, to be sure. i wonder what it'd be like using that super time stretch jobby.

Well this idea of using a image to make sound is great i will need to download and test


Register / login
You must be a member to reply or post. signup or login