#use wml::tmpl::main title="schearnet -- TCP dump for audiophiles" PAGE=programming SUBPAGE=schearnet

<H1>What is it?</H1>
<P>This little program was inspired by <A href="http://hans.fugal.net/src/hearnet">hearnet</A>,
a <A href="http://jackit.sf.net/">JACK</A> 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
<A href="$(ROOT)/music/sc.html">SuperCollider</A> as a synthesis backend
was born.
</P>
<P>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:
<tt>schearnet -i eth0 -h 172.23.1.32</tt>
</P>
<H2>Sound example</H2>
<P>As an experiment, I am currently running an Ogg live stream of the
network traffic at my home internet connection.  Click
<A href="http://mozart.soundportal.at:8000/delYsid.ogg">here</A> to
listen in on the fun!
</P>
<H2>Filter expressions</H2>
<P>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 <tt>schearnet -i eth0 udp port 53</tt> 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: <tt>schearnet -i eth0 -h 172.23.1.32 "not (dst host 172.23.1.32 and udp dst port 57110)"</tt>
</P>
<H2>Download</H2>
<P>Grab the sourcecode <A href="schearnet.c">here</A>.  It is a plain
C file, compilation and usage instructions are in the first few
lines of the file.
</P>
