NearWave CLI
Near-field data transmission over sound using compression, encryption, and chunked encoding
Overview
NearWave is a command-line tool for transferring data between devices using sound. It encodes arbitrary input into audio signals — audible or ultrasonic — and decodes them on the receiving end. No network, no pairing, no Bluetooth. Just a speaker and a microphone.
The system handles compression, optional encryption, chunked encoding, and error correction. It is designed to work reliably in real-world acoustic environments with ambient noise and hardware variation.
Core Idea
Sound is a viable transport layer for short-range data transfer. Every device with a speaker and a microphone already has the hardware. NearWave treats audio as a physical-layer protocol — structured, compressed, and optionally encrypted — rather than a novelty.
- No network infrastructure required
- No pairing or handshake over Bluetooth or Wi-Fi
- Works across any combination of devices that can produce and capture sound
- Operates in environments where radio-based communication is restricted or unavailable
Capabilities
- Audible and ultrasonic transmission — configurable frequency ranges depending on environment and hardware
- Compression — supports zstd and brotli to minimize transmission time
- Optional encryption — AES-256-GCM for payloads that require confidentiality
- Chunked encoding — splits data into independently decodable frames with per-chunk CRC validation
- Error correction — Reed-Solomon codes for forward error correction over noisy channels
- Adaptive gain — adjusts output amplitude based on ambient noise floor measurements
How It Works
Send Path
input → compress → encrypt → chunk → encode (FSK/OFDM) → audio output
Receive Path
audio input → demodulate → reassemble chunks → decrypt → decompress → output
Each chunk carries its own header with sequence number, CRC, and encoding metadata. The receiver reconstructs the stream independently per chunk, allowing partial recovery if frames are lost.
CLI Interface
Send a file:
nearwave send --file notes.txt --profile reliable
Receive and write to disk:
nearwave receive --output received.txt
Send with encryption:
nearwave send --file payload.bin --encrypt --key $NEARWAVE_KEY
Benchmark a profile:
nearwave bench --profile fast --size 4096
Performance
Benchmarking covers compression ratio, encoding latency, and end-to-end throughput across profiles and payload sizes.
| Metric | Reliable | Fast | Ultrasonic |
|---|---|---|---|
| Throughput | ~120 bps | ~450 bps | ~200 bps |
| Compression (zstd, 4KB text) | 62% reduction | 62% reduction | 62% reduction |
| Encoding latency (4KB) | ~34s | ~9s | ~20s |
| Error tolerance | High | Low | Medium |
Compression is applied before encoding, so gains compound directly into reduced transmission time. Brotli achieves higher ratios on text payloads but adds ~15% more CPU time compared to zstd.
Profiles
Reliable — lower frequency range, wider tone spacing, stronger error correction. Best for noisy environments or longer distances. Slowest throughput.
Fast — higher symbol rate, narrower tone spacing, minimal redundancy. Best for quiet, close-range transfers where speed matters.
Ultrasonic — operates above ~18 kHz. Inaudible on most hardware. Requires devices with high-frequency speaker and microphone response. Throughput sits between reliable and fast. Useful when audible noise is unacceptable.
Use Cases
- Offline data sharing — transfer text, config snippets, or small files between machines without any network
- Air-gapped communication — move data across security boundaries where network connectivity is intentionally absent
- Device-to-device transfer — quick exchange between a laptop and a phone, or between two terminals in the same room
- Restricted environments — contexts where Wi-Fi and Bluetooth are disabled or monitored
Philosophy
NearWave is a protocol and a system, not just a tool. The CLI is one interface to a layered architecture — compression, encryption, encoding, modulation — each designed to be independently testable and replaceable. The goal is a principled approach to acoustic data transfer that treats sound with the same rigor as any other transport medium.
Status
In development. Core send/receive pipeline is functional. Compression and encryption layers are integrated. Ultrasonic profile is experimental.
Notes
Active benchmarking across hardware combinations is ongoing. Improvements to adaptive gain control and multi-channel encoding are in progress. Profile tuning for specific environments (office, outdoor, industrial) is planned.