# AI DJ · Rustwave

The AI DJ rebuilt in Rust: one self-contained binary that synthesises every track itself from a key, tempo and energy, plans a harmonic set on the Camelot wheel, and mixes it forever on two equal-power Web Audio decks. Six palettes, a spectrum ring, waveform and set arc, no samples or streaming.

**Status:** Live · Projects · 2026

- **Local checkout:** `/Users/simon/Developer/ai-dj-rust` (branch `main`, last commit c4ffb14, 2026-11-06 — Keep every planned transition on the Camelot wheel: relative keys now share a slot instead of flipping the parallel key)
- **Repository:** https://github.com/ShimonNavon/ai-dj-rust
- **On another machine:** `git clone https://github.com/ShimonNavon/ai-dj-rust` — the paths below are Simon's Mac
- **Listen (tailnet):** http://ubuntu03:30120/
- **Where it runs:** namespace ai-dj-rust · NodePort 30120 · tailnet only · 1 replica
- **Note:** Tailnet only

## Stack

Rust, axum, tokio, generative DSP (no samples), Web Audio API, Kubernetes, musl static image

## Start here

- `src/synth.rs` — drum/bass/pad/arp voices, sidechain ducking, riser, mix, WAV writer and peaks
- `src/planner.rs` — track specs and id encoding, mood profiles, set planner
- `src/music.rs` — keys, scales, Camelot wheel and harmonic compatibility
- `src/main.rs` — axum server, /api/set, /api/track, /audio, LRU render cache
- `web/index.html` — single-file two-deck player: crossfades, waveform, spectrum ring, queue, set arc
- `deploy/deploy.sh` — build on ubuntu02, registry tunnel via ubuntu04, rollout on ubuntu03
- `deploy/k8s.yaml` — namespace, Deployment and NodePort 30120

## Commands

- **Run:** `cargo run --release`
- **Test:** `cargo test`
- **Deploy:** `./deploy/deploy.sh`

## Deploy and where it runs

- Deployment in namespace ai-dj-rust on ubuntu04, NodePort 30120.
- Image built on ubuntu02 (rust:alpine, musl, scratch) and pushed through an SSH tunnel to the registry on ubuntu04.
- Read-only HTTP: every route is GET, so Cloudflare-friendly.

## Current state

Live at http://ubuntu03:30120/. Generates 16-bar tracks on demand, plans 8-track sets by mood, crossfades on equal-power curves and extends the queue forever.

## Watch out

- Tracks are deterministic from the id; changing synth code changes old ids.
- Render cache is in memory (12 tracks), so run one replica.
- No Range support on /audio; the player never seeks, it only crossfades.
- Audio is uncompressed WAV (~5 MB per track) to stay dependency-free.

## Tags

Rust, Generative audio, Camelot mixing, Web Audio, Kubernetes

---

Brief generated 2026-11-08 from `~/Developer/my-projects/context/`. Canonical URL: https://projects.navonsimon.com/context/ai-dj-rust.md
