TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Catting weird things to /dev/audio

72 pointsby mattybabout 16 years ago

15 comments

RiderOfGiraffesabout 16 years ago
In 1979 I was debugging some Z80 assembler by putting a radio next to the processsor and picking up the RF noise. I could tell by the quality of the sound which loop it was in, and trace the execution as it happened. This was on a device that only had a serial line as its interface, and the problem was in the processing of the data, so it would occasionally just hang, making "standard" debugging impossible.<p>Later (1980) when I wrote a BASIC to Z80 compiler I used the same technique to profile the code and achieved a 5x speed-up by knowing which loops ran slowly.
cubixabout 16 years ago
Several years ago I was stuck in a data centre over night upgrading our systems with other team members who were working remotely. I was desperately tired and done my part, but had to wait around to monitor things while the rest finished up. Instead of staring at the screen, trying in vain to keep my eyes open, I put /dev/audio to good use by writing a simple script to wake me when tcpdump picked up the traffic I was looking for. I was able to lay my head down, guilt free, and steal 20 or 30 minutes of precious sleep between testing sessions.
评论 #564947 未加载
philhabout 16 years ago
&#62;a good place to start, would be yes &#62; /dev/audio, which outputs a high whining as the value 'y' is sent as audio over and over.<p>The key point of this combination is that yes outputs "y\ny\ny\n...". If you just send one character over and over you don't hear anything - I think the difference between adjacent character values determines the frequency of the output.<p>&#62;Plus if there are any sound files on your drive saved in a lossless format they just play at random and then disappear back into the soup.<p>They need to be uncompressed (ie. contain raw audio data), not just lossless.
jodrellblankabout 16 years ago
One of the better stories I've read was the guy who piped the output of ping to his speakers, turned the volume up, and went around the office wiggling the token ring cable listening out for the place with the unreliable connection.
10renabout 16 years ago
<p><pre><code> cat /dev/urandom &#62; /dev/audio </code></pre> I use it as a white noise generator, to cover ambient noise at night. Anyone know how to make a low pass filter (to make pink/red/brown noise)? I tried repeating the random source, to increase the wavelength, but it gets little R2D2 chirps and clicks in it (because of the step-like waveform):<p><pre><code> cat /dev/urandom | sed 's/./&#38;&#38;&#38;&#38;&#38;&#38;/g' &#62; /dev/audio</code></pre>
评论 #564802 未加载
评论 #565496 未加载
评论 #566508 未加载
SwellJoeabout 16 years ago
Many years ago this facet of Linux was the thing that really made me realize just how astonishingly wonderful the central idea of UNIX (everything is a file) really is. It also puts in stark contrast those systems that haven't grokked this beautifully simple idea.
评论 #564782 未加载
windsurferabout 16 years ago
It sounded like a dial up modem when I did this:<p><pre><code> cat /dev/mem &#62; /dev/audio </code></pre> Also, for some reason, this command makes it "beep" on every eleventh character you type. Probably something to do with buffers.<p><pre><code> cat /dev/input/by-path/platform-i8042-serio-0-event-kbd &#62; /dev/audio</code></pre>
评论 #565154 未加载
erikwiffinabout 16 years ago
even more fun<p><pre><code> wget http://www.wikipedia.com --output-document=- &#62; /dev/audio </code></pre> Download a webpage, output to soundcard. Works pretty well, I need to find a bigger page to work with though.
评论 #564922 未加载
swivelmasterabout 16 years ago
Is this possible on a Mac?
评论 #564880 未加载
评论 #564857 未加载
评论 #564690 未加载
windsurferabout 16 years ago
Find all the .wav files and play them: find . -name '*.wav' -exec cat {} &#62; /dev/audio \;<p>I guess I don't have any at the right frequency, though :(
kaensabout 16 years ago
If you have a remote machine that has a microphone plugged into it, you can use this to listen to what's going on in the room remotely.
joshuabout 16 years ago
From the original document:<p>&#62; In order for noise to happen there must be at least some variation.<p>It's pretty neat. The data pretty much represents the position of the speaker.<p>Audio stuff is pretty fascinating; I read a great book on explaining DSPs for audio processing. I'll have to dig it out of my closet.
chanuxabout 16 years ago
Reminds me old days I tried to listen to the linux kernel :D. A small typo I did filled up the terminal with lots of garbage. Later I learned I can rcover such a situation with..<p>$reset
windsurferabout 16 years ago
If your terminal gets messed up from catting random characters to stdout, type 'reset' and press enter.
barrkelabout 16 years ago
If you have Windows, you can play along to a degree using Cygwin and /dev/dsp instead.