2026-03-24 22:27:26 +01:00
# NetSynth
## What This Is
2026-03-26 15:23:04 +01:00
A Go CLI tool that captures live network traffic on an interface, classifies packets by protocol, and synthesizes an ambient MP3 soundscape where each traffic type produces a distinct harmonic drone or tone. Supports live capture with BPF filtering and offline pcap file sonification.
2026-03-24 22:27:26 +01:00
## Core Value
Network traffic patterns are instantly recognizable as distinct sounds — a ping sounds different from HTTPS noise, which sounds different from a port scan.
2026-03-26 15:23:04 +01:00
## Current State
**v1.0 MVP shipped 2026-03-26.** 3,254 lines of Go across 6 packages.
Tech stack: gopacket/gopacket v1.5.0, packetcap/go-pcap (pure Go capture), sjzar/go-lame v0.0.9 (embedded LAME), spf13/cobra v1.10.2.
All 16 v1 requirements validated. Full pipeline working: capture -> classify -> aggregate -> synthesize -> MP3.
2026-03-26 17:42:52 +01:00
**Phase 5 complete 2026-03-26:** Waveform types (sine, square, sawtooth, triangle) with bandlimited synthesis added. OscillatorBank decoupled from global config — NewBank now accepts injected config maps with dynamic gain scaling.
2026-03-26 21:09:02 +01:00
**Phase 6 complete 2026-03-26:** TOML config system added. Users can override frequency and waveform per traffic class via `netsynth.toml` (auto-discovered or `--config` flag). Partial overrides, unknown-key validation, and fail-fast startup errors. New `config` package with BurntSushi/toml.
2026-03-24 22:27:26 +01:00
## Requirements
2026-03-26 15:23:04 +01:00
### Validated (v1.0)
2026-03-24 22:27:26 +01:00
2026-03-26 15:23:04 +01:00
- Capture live packets from a specified network interface until Ctrl+C
- Classify packets by known protocols (ICMP, DNS, HTTPS, SSH, etc.) with 12 predefined rules
- Auto-cluster unrecognized traffic into 4 hash-bucketed unknown classes with distinct tones
- Aggregate traffic into 500ms time windows driving amplitude evolution
- End-to-end pipeline: capture -> classify -> synthesize -> MP3 output
- Map each traffic class to a distinct ambient/drone layer (sine oscillators + EMA smoothing)
- Stereo mixing with constant-power panning, no distortion
- MP3 encoding via embedded LAME, zero-packet guard
- CLI with `-i` , `-o` , `--list-interfaces` , `--verbose` , `--filter` , `--read` flags
- BPF capture filter for scoping live traffic
- Offline pcap file sonification with timestamp-based windowing
2026-03-26 14:45:59 +01:00
2026-03-24 22:27:26 +01:00
### Active
2026-03-26 16:44:15 +01:00
(See REQUIREMENTS.md for v1.1 requirements)
2026-03-24 22:27:26 +01:00
### Out of Scope
2026-03-26 16:44:15 +01:00
- Real-time audio playback — file output only
2026-03-24 22:27:26 +01:00
- GUI or web interface — CLI only
- Rhythmic/percussive output — ambient/drone style only
2026-03-26 16:44:15 +01:00
- Stereo position configuration — v1.1 focuses on frequency, waveform, and custom rules
2026-03-24 22:27:26 +01:00
## Context
2026-03-26 15:23:04 +01:00
- Built in Go (CGO_ENABLED=1 for LAME), single binary output
- Packet capture requires root/CAP_NET_RAW on Linux
- Pure Go capture layer (no libpcap dependency)
- MP3 encoding embeds LAME C source (no system library needed)
- 14 traffic classes: 10 known protocols + 4 hash-bucketed unknowns
2026-03-24 22:27:26 +01:00
## Constraints
- **Language**: Go — user preference, single binary output
- **Privileges**: Packet capture requires root/CAP_NET_RAW on Linux
- **Audio format**: MP3 output (not WAV or raw PCM)
2026-03-26 15:23:04 +01:00
- **Interaction model**: Non-interactive capture (run -> Ctrl+C -> file saved)
2026-03-24 22:27:26 +01:00
## Key Decisions
| Decision | Rationale | Outcome |
|----------|-----------|---------|
2026-03-26 15:23:04 +01:00
| Go over Python/Rust | User preference, single binary, good perf | Good |
| Ambient/drone style | Layered tones better represent continuous traffic patterns | Good |
| Predefined + auto-cluster | Known protocols get recognizable sounds; unknown traffic still represented | Good |
| File output only | Simpler v1, avoids real-time audio complexity | Good |
| go-pcap over libpcap | Pure Go, no CGo for capture, cross-compilation friendly | Good |
| go-lame (embedded C) over shine-mp3 | Better quality, smaller files, acceptable CGo tradeoff | Good |
| Hand-rolled synthesis over audio libraries | 20 lines of oscillator code, no unnecessary dependencies | Good |
| Hash-bucketed unknowns over k-means | Deterministic, zero-config, sufficient for v1 audio distinction | Good |
| Ordered []Rule classifier over switch | Configurable, extensible, first-match-wins semantics | Good |
| 500ms window duration | Balances temporal resolution against snapshot frequency for synthesis | Good |
2026-03-24 22:27:26 +01:00
2026-03-26 16:44:15 +01:00
## Current Milestone: v1.1 Custom Sound Mappings
**Goal:** Users can customize how traffic sounds via a TOML config file
**Target features:**
- Custom frequency per traffic class (override built-in Hz values)
- Custom waveform per class (sine, square, sawtooth, triangle)
- User-defined classification rules with custom sounds
- Auto-discover config from ./netsynth.toml or ~/.config/netsynth/config.toml
- --config flag for explicit config path
2026-03-24 22:27:26 +01:00
## Evolution
This document evolves at phase transitions and milestone boundaries.
2026-03-26 16:44:15 +01:00
**After each phase transition:**
1. Requirements invalidated? -> Move to Out of Scope with reason
2. Requirements validated? -> Move to Validated with phase reference
3. New requirements emerged? -> Add to Active
4. Decisions to log? -> Add to Key Decisions
5. "What This Is" still accurate? -> Update if drifted
2026-03-26 21:14:30 +01:00
6. Update README.md to reflect the current state of the project (features, usage, installation)
2026-03-26 16:44:15 +01:00
**After each milestone:**
1. Full review of all sections
2. Core Value check — still the right priority?
3. Audit Out of Scope — reasons still valid?
4. Update Context with current state
2026-03-24 22:27:26 +01:00
---
2026-03-26 16:44:15 +01:00
*Last updated: 2026-03-26 after v1.1 milestone start*