Chuck + Ngrep: Listening to the Network
Posted by admin
chuck: http://chuck.cs.princeton.edu/
ngrep: http://ngrep.sourceforge.net/
Using chuck and ngrep, you can translate the ascii output of ngrep into midi sounds in real time by reading from a file with chuck which is being appended by ngrep:
sudo ngrep -d en1 '' > network
chuck listen.ck < network
listen.ck source:
// computer key input, with sound
KBHit kb;
// patch
Impulse i => BiQuad f => dac;
// set the filter’s pole radius
.99 => f.prad;
// set equal gain zeros
1 => f.eqzs;
// initialize float variable
0.0 => float v;
// set filter gain
.5 => f.gain;
// time-loop
while( true )
{
// wait on event
kb => now;
// generate impulse
1.0 => i.next;
// loop through 1 or more keys
while( kb.more() )
{
// set filter freq
kb.getchar() => int c;
if(c < 58) 58 %=> c;
if(c > 120) 120 %=> c;
c => Std.mtof => f.pfreq;
// print int value
<<< “ascii:”, c >>>;
}
}Sounds a bit like a colorful geiger counter.
Maybe you can ngrep for something specific and learn to recognize the sound of it amongst other traffic.