The Sound of Data
Spurred on by a recent weekend full of hot-tub induced dehydration, beer, and lack of sleep, some friends of mine discovered an interesting (I think, I at least) capability of the command line computer interface. Prepare to be really geeked-out.
As I wrote briefly about last year, on the Linux command line, you can pass the output of one program into another by joining them together with | (the “pipe” character). For example, if you entered whois actsofvolition.com | gedit, it would take the output of the whois lookup for that domain name and open it in gedit, a text editor.
White Noise
It occurred to one of us, in our sleep-deprived state, that you might be able to pipe the output of the random number generator into an audio player, and hear random noise. So, we tried this:
cat /dev/urandom | aplay
Let me explain: cat is a program to output the contents of a file. The /dev/urandom is a random number generator for linux. aplay is a simple sound player. So here, we are taking random data and asking an audio player to play it. It worked! It sounds like white noise. Here’s a short MP3 sample: random.mp3 (run out my headphone jack and and back into my line-in, since I could figure out how to record the audio directly to disk.
Hearing Your Hard-Drive
So, the next logical step (again, very little sleep) was to try sending in some non-random data. So we tried:
ls -R / | aplay
The ls command displays the contents of the current director. The extra options tell it to start at the root of your hard-drive (/) and go recursively into all sub-folders (-R). It basically lists out the file and folder names on your entire hard drive.
This sounded more like the bleeps and squawks of a modem making a dial-up connection (remember picking up another phone when someone was dialed-up to the internet?). Here's an MP3 sample: filesanddirs.mp3.
The Digital Anthem
Finally, we wanted to hear what some more structured data sounded like. Images and photos in compressed file formats like PNG and JPEG sound pretty much like random noise, due to the compression. However, un-compressed image files, like BMP (bitmap) files are very simple and structured.
So, I grabbed simple bitmap image of the American flag (usa.bmp) and the results are pretty cool. It sounds like digital hardcore.
cat usa.bmp | aplay
Here's the MP3 of the American flag bitmap file: usa.mp3.
Sox is a thing which does for sound what ImageMagick's convert does for images. Since you're feeding in data whch doesn't have any formatting at all, you have to lie to sox and tell it a format that the data is in: that's what all the options do. Sox also doesn't do mp3 encoding, so this outputs an ogg, but I suppose you could sox something into a wav file and then chuck that through your choice of mp3 encoder if you wanted to.
I am firmly of the opinion that you never ever ever need to use a wire to connect a bit of a computer to another bit of the same computer :)
On the other hand, I knew about sox: this would have been considerably harder if I didn't...
The next step is to convert mouse movements into sound, and voila! ... a new musical instrument.
Now what happens when it comes to an actually sound file for the ls -R / one?
It was kind of fun listening to a 3D render.
The flag sounds strangely good.
Speaking of turning image data into sound: Winamp has its Nullsoft Tiny visualisation plugin, that outputs the equalizer to you screen, placing all frames vertically next to one another, creating a human understandable left-to-right image of sound.
You can configure the plugin to create black where there is sound, and white where there is none, and the result is as if you've tried to draw out the music on paper with smudgy charcoal. I have a couple screenshots; I'll uploade them one time.
uuencode /bin/ls /bin/ls | say
Or for some annoying singing:
uuencode /bin/ls /bin/ls | tr [-az-AZ-] a | say
I kind of like the rhythm of:
uuencode /usr/bin/say /usr/bin/say | tr [-az-AZ-] k | say
Or the 50's stylings of:
uuencode -m /bin/ls /bin/ls | head -11 | tail -10 | sed 's/AAA/ doowaa /g' | sed 's/A/ boop boop /g' | say
Rock on.
Whee
Think of the things you could do with this! It's like MIDI, but higher pitched and not as good!
Wheres mspaint? I've got composing to do!
By the way, I don't seem to have aplay in debian sarge. Is there an equivalent?
So, you're data files appeared as MP3s.
And, you could play them. And, they really really hurt my ears.
Doesn't have to be amusical noise.
Do it and take into MOMA :)
cat /proc/kore > /dev/dsp
The sound of the kernel
I had a couple (rather large) word documents that had some great sounds in them.
Cool Edit (now Audition) is the most fun for playing around with the sounds you find in data.
It's about 20 seconds of Polynomial-C by Aphex Twin.
I remember reading about something similar, but different: using a matrix printer to play music. Instead of a picture producing music, you would have music producing a picture. I betcha there is a whole scene out there doing this. Now all you need to do is salvage that old matricprinter (and probably a computer with a paraller port) from the garage/dump :)
Olivier (Brussels)
http://www.sat.qc.ca/the_user/dotmatrix/en/intro.html
--
i usually take a Y-splitter and hook up both audio and video feed to my tv video-in , so it can blend signals (nice when you loop the visuals) i'll have a show on feb 2nd featuring a distorted sounds from a tv tube loopback.
cheers
tomek
try mounting a windows partition and catting *.DLL (and other gigantic win32 binaries) to /dev/dsp ;) i think there's a CD of this somewhere, perhaps tigerbeat6 on mdos.at..
btw /dev/kmem sounds much better than /dev/urandom ;)
Converts images to music in an interesting way. See what your favorite pictures sound like!Requirements:
Mac OS X 10.1 or later.
For Unix/Linux/*ux and Win32 users, there's a cute little toy called Flite which can replace 'say' in the pipelines above (even under Windows, if you're using Cygwin). It's a cut-down version of the Festival speech-synthesis package; instead of being probably as complicated as Apache -- more so in fact as more people use Apache -- to install and configure properly, it lives in a single executable. You only get one voice which sounds somewhat like a drunken Norseman, but go figure.
I was playing around with this and I did:
$ perl -e '@w = split / /, "Now is the time for all good men to come to the aid of their country."; print "$_\n"x1000 foreach @w;' > /dev/dsp
which gave a very interesting series of fairly clear tones, kinda chiptuney and very nifty.
Another neat trick is to put an & on the end of that and start it multiple times at different intervals; you get some interesting harmonics and distortion effects, kind of thing, and yeah.
Undrhil
interested in playing a time series, like what audacity displays when you load a wav file. The difference is that my input data file has two columns
the first one for the time and the second for the amplitude of the sound. What I want to do is play the
sound chaos for ex. The second column for me is some
variable I obtain from a map or the solution of a system of differential equations. The data could be
just one column as well (just the amplitudes).
Thanks,
Adriano.
