← archive

Listen to Packets

Cover image

This project is a data driven two-channel audio experiment to sonify network traffic on the router. It runs on nodejs or Flask.py. The sounds are generated with tonejs, with data captured with tshark.

I built a backend with Flask-SocketIO, and hosted it with a raspberry pi router with intending to create a locally hosted web page that people on the network could listen to the traffic being passed through the router. I had problems passing the real-time data to the client so for prototyping I decided to use pre-captured data.

When coding the project, I used Tshark to capture network traffic on my laptop's wireless interface and wrote it to a text file for about 10 minutes, with 4013 packets captured. Using a node server for the projects I serve the text file to the client and process it on their computer.

The text file is read line by line and with ToneJS a synth is created for each packet if the packet is sent to or from an encrypted port (443) a C2 note is played on the left channel. If a packet is sent in the clear (port 80) a C3 note is played on the right channel. All other packets trigger an E2 note played on both channels. I use the synths trigger attack release method to overlay the notes and create a richer sound. The packet being analyzed is displayed on screen and colorized as well.

Around 400 packets the audio quality drastically drops. I am guessing it has to do with having a maxed out audio buffer, but I could not resolve it. I tried a couple things such as keeping track of the synths and every 10 lines shifting the array and disposing the synth, and while it sounds cleaner it doesn't solve the problem around 400 packets. I attempted to close the audio context and open a new context, per, but that crashes the program.

I plan on keep working on this to fix the audio buffer issues and discover the best way to stream live data as well.