This little program was inspired by hearnet, a JACK client for listening to network traffic. I liked that idea so much that I spend nearly the whole day playing with it, but there are some limitations to the original. One thing is that I have to use hearnet on a machine which has a soundcard. Since my router is a little ARM based box, sound is a no go on that thing, and I'd really like to have the synthesis on my audio workstation. SO the idea to rewrite hearnet such that is utilized SuperCollider as a synthesis backend was born.
The small C program below listens for network packets on a specific interface given an optional filter expression and sends OSC message to SuperCollider server (scsynth) to initiate the actual sound generation. This means I can run schearnet on my router like this: schearnet -i eth0 -h 172.23.1.32
As an experiment, I am currently running an Ogg live stream of the network traffic at my home internet connection. Click here to listen in on the fun!
schearnet supports stnadard pcap filter expressions. If you have used tcpdump filter expression yet, schearnet's are the same. You could for instance say something like schearnet -i eth0 udp port 53 to only listen in on DNS traffic. This feature is also useful when schearnet is running on a remote host with just one interface, which leads to a feedback loop since schearnet will see its own outgoing UDP packets. To avoid this, simply add a filter expression to make it ignore its own traffic, like: schearnet -i eth0 -h 172.23.1.32 "not (dst host 172.23.1.32 and udp dst port 57110)"
Grab the sourcecode here. It is a plain C file, compilation and usage instructions are in the first few lines of the file.