Saturday, March 17, 2007

The Sound of Linux

Recently, I came across some rather neat, if obscenely geeky, things to do with sound in linux. Actually, the first can be EXTREMELY useful. Often, using new systems, I do something that results in the PC speaker squawking. If it is trying to use tab-complete in a dir with too many matches available, or a bad VIM command, that tiny speaker decides to notify me of the error of my ways. After this happens one or two times, I am sorely tempted to put my fist through the computer, just to stop that wretched sound. There is a better way, viz., "modprobe -r pcspkr". This effectively kills the PC speaker, for your current session. No more squawking, no more pain. Once you logout, the speaker works fine, it just temporarily saves you the annoyance.

Another thing I have been experimenting with is much cooler. Apparently, you can take any file and send it to your speaker. To try this, get into the CLI, and first do "wget". Then do "cat index.html > /dev/dsp". Of course, you can dispense with downloading's homepage and use any file you want, of any type. Even "ls /etc > /dev/dsp" will do. As long as your sound is enabled, you will get some static. I believe what is actually happening is that you are sending the binary content of whatever you pass to your sound card, and it is playing through the speaker. Images, I find, are particularly interesting. An amusing experiment I have not finished: Make a recording, hopefully a comical one, encode it, and turn its binary content into some text. Embed this in a hidden div in a web page, and get someone to try the above commands on the page. I don't know anything about encoding, or much of anything at this level, but it is fun to play with.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home