2026-03-24 22:27:26 +01:00
# NetSynth
## What This Is
2026-03-26 22:05:09 +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, offline pcap file sonification, and fully customizable sound mappings via TOML config.
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
2026-03-27 19:38:58 +01:00
**v1.2 shipped.** 35 built-in traffic classes across 9 protocol families (Infrastructure, Web, Mail, Remote Access, File Transfer, Database, Discovery, VoIP, Unknown). C major pentatonic frequency tuning (just intonation, 65-6534 Hz) with ADSR envelope shaping (sustained vs bursty modes), LFO pitch/tremolo modulation (Eno technique with incommensurable rates), and tanh soft limiter. Group-ordered `--print-config` with section headers. `[groups]` TOML config for reassigning protocols to different sound families. ~6,500 lines of Go across 7 packages, full test suite green.
2026-03-26 15:23:04 +01:00
2026-03-26 22:05:09 +01:00
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, BurntSushi/toml v1.6.0.
2026-03-26 15:23:04 +01:00
2026-03-27 16:48:53 +01:00
All v1.0 + v1.1 + v1.2 requirements validated (45 total). Full pipeline: capture -> classify -> aggregate -> synthesize -> MP3.
2026-03-26 21:56:40 +01:00
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
2026-03-27 19:38:58 +01:00
- Map each traffic class to a distinct ambient layer with ADSR envelopes, LFO modulation, and pentatonic tuning
- Stereo mixing with constant-power panning and tanh soft limiting
2026-03-26 15:23:04 +01:00
- 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-26 22:05:09 +01:00
### Validated (v1.1)
- TOML config file with partial override semantics (frequency, waveform per class)
- Auto-discovery: `./netsynth.toml` , `~/.config/netsynth/config.toml`
- `--config` flag for explicit config path (error if missing)
- Unknown-key validation with clear error naming the typo'd key
- Four waveform types: sine, square, sawtooth, triangle (bandlimited)
- User-defined classification rules via `[[rules]]` TOML blocks
- User rules prepend before built-ins (first-match-wins priority)
- Auto-frequency assignment for custom class names (no silent gaps)
- `--print-config` outputs effective config as commented TOML
2026-03-27 16:48:53 +01:00
### Validated (v1.2)
- Removed stale constants and future-proofed test bounds for extensibility
- 21 new protocol classifications: Mail (IMAP, POP3, SMTP-sub), File Transfer (FTP, SMB, TFTP), Remote Access (RDP, Telnet, VNC), Database (MySQL, PostgreSQL, Redis, MongoDB), Discovery (mDNS, SSDP, SNMP), VoIP (SIP), Web (QUIC/HTTP3), Infrastructure (LDAP, Kerberos, Syslog)
- No regression in existing 14 protocol classifications
2026-03-27 19:38:58 +01:00
- C major pentatonic frequency tuning (just intonation) with family-coherent waveforms and group field on FreqConfig
- ADSR envelope system: sustained protocols (2s attack, 4s release) and bursty protocols (30ms attack, no sustain)
- LFO modulation: per-group incommensurable pitch wobble and amplitude tremolo (Eno technique)
- Tanh soft limiter on master output prevents clipping
- Auto-assign frequency range moved to 5000-8000 Hz (collision-free with built-ins)
2026-03-27 16:48:53 +01:00
- Group-ordered `--print-config` output with section headers
- `[groups]` TOML config for protocol-to-group reassignment
2026-03-24 22:27:26 +01:00
### Active
2026-03-27 16:48:53 +01:00
(No active requirements — planning next milestone)
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
2026-03-27 19:38:58 +01:00
- Fully rhythmic/beat-based output — ambient style with percussive accents for bursty protocols
2026-03-26 22:05:09 +01:00
- Stereo position configuration — add in future if requested
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)
2026-03-27 16:48:53 +01:00
- 35 built-in traffic classes across 9 families: Infrastructure, Web, Mail, Remote Access, File Transfer, Database, Discovery, VoIP, Unknown (extensible via custom rules)
- TOML config with partial overrides, unknown-key validation, auto-discovery, and `[groups]` protocol-to-group reassignment
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 |
2026-03-27 19:38:58 +01:00
| C major pentatonic tuning (just intonation) | Any combination of active tones sounds consonant; replaced major-second ladder | Good |
| ADSR envelopes over pure EMA | Sustained flows get ambient pads; bursty protocols get percussive accents | Good |
| LFO with incommensurable rates | Eno technique ensures soundscape never repeats; each group has unique modulation | Good |
| Tanh soft limiter over hard clipping | Preserves dynamics while preventing distortion during traffic spikes | Good |
2026-03-27 16:48:53 +01:00
| Group field as string (not enum) | Extensible for new family names without code changes | Good |
2026-03-26 15:23:04 +01:00
| 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-26 22:05:09 +01:00
| BurntSushi/toml over manual parsing | Industry-standard Go TOML library, Undecoded() catches typos | Good |
| Pointer fields for partial overrides | `*float64` , `*string` distinguish "not set" from zero values | Good |
| Bandlimited additive synthesis | Prevents aliasing in square/sawtooth/triangle without FFT overhead | Good |
| FNV-32a hash for auto-frequency | Deterministic, collision-resistant, maps to unused 1200-2350 Hz range | Good |
| LoadResult struct over tuple return | Clean single return value, extensible for future fields | Good |
| --print-config as flag (not subcommand) | Consistent with --list-interfaces pattern, simpler CLI surface | Good |
2026-03-24 22:27:26 +01:00
2026-03-26 22:05:09 +01:00
## Shipped Milestones
2026-03-26 16:44:15 +01:00
2026-03-27 16:48:53 +01:00
<details>
<summary>v1.2 Extended Protocol Coverage (shipped 2026-03-27)</summary>
35 built-in traffic classes across 9 protocol families with major-second frequency ladder, group-ordered print-config, and [groups] TOML reassignment.
</details>
2026-03-26 22:05:09 +01:00
<details>
<summary>v1.1 Custom Sound Mappings (shipped 2026-03-26)</summary>
2026-03-26 16:44:15 +01:00
2026-03-26 22:05:09 +01:00
Users can customize how traffic sounds via a TOML config file — frequency, waveform, custom classification rules, and config inspection.
</details>
<details>
<summary>v1.0 MVP (shipped 2026-03-26)</summary>
Full capture -> classify -> synthesize -> MP3 pipeline with 14 traffic classes, BPF filtering, and pcap sonification.
</details>
2026-03-26 16:44:15 +01:00
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-27 16:48:53 +01:00
*Last updated: 2026-03-27 after v1.2 milestone*