From c3768f816a949daff86872a49b3d44a650bc8b43 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 5 Jul 2026 10:14:11 +0200 Subject: [PATCH] Fixed some UI issues --- CLAUDE.md | 16 +++-- README.md | 91 +++++++++++++++++------- frontend/src/components/GridControls.tsx | 48 ++++++++++++- frontend/src/components/MainWaveform.tsx | 19 +++-- frontend/src/components/PrepStrip.tsx | 38 +++++++++- 5 files changed, 168 insertions(+), 44 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 0c87d1d..452c2a4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,7 +34,8 @@ Two independent apps that talk over HTTP: picker's "Automatic" option; sorts newest Traktor version first. - `prefs.py` — tiny persisted user-prefs store in `userprefs.json` (resolved relative to the package so it travels with the app; gitignored). Holds the - last-opened collection path and the library column layout. Best-effort I/O. + last-opened collection path, the library column layout, and the prep deck's + main-waveform zoom (`mainZoomSec`). Best-effort I/O. - `schemas.py` — Pydantic response/request models. - `main.py` — FastAPI routes (all under `/api`). Holds an `AppState` with the currently-loaded collection; it starts **unloaded** and the collection is @@ -56,8 +57,11 @@ Two independent apps that talk over HTTP: (right-click → multi-field metadata + album-art edit), `StatusBar`, `RatingStars` (read-only, or click-to-set when given `onChange`), `Toast`. - **Prep strip** (DJ deck across the top of the window): `PrepStrip` owns it — - transport (play/pause, CUE), two waveforms (`MainWaveform` scrolling+zoomable, - `OverviewWaveform` whole-track), `LoopControls`, `HotcueBar`, `GridControls`. + transport (play/pause, CUE), two waveforms (`MainWaveform` scrolling+zoomable + — its zoom is owned by `PrepStrip` so it survives track switches and persists, + `OverviewWaveform` whole-track), `LoopControls`, `HotcueBar`, `GridControls` + (BPM readout/editor, fine ±0.01 / coarse ±0.25 BPM nudge, /2·×2, tap tempo, + grid-phase nudge, set beat 1, lock, delete grid). Prep libs live in `src/lib/`: `playbackEngine.ts` (Web Audio, seamless loops), `scratchEngine.ts` (drag-to-scratch), `waveform.ts` (frequency-colored analysis + paint), `cues.ts` (draw cues/loop/beatgrid/cue-point). See "Prep @@ -71,7 +75,9 @@ Two independent apps that talk over HTTP: button flushes to disk. Styling is Tailwind v4 with tokens in `src/index.css`. Library column layout (visibility/order/width) persists to `userprefs.json` via `GET`/`PATCH /api/prefs` (debounced; hydrated on launch, merged against - defaults so newly-added columns still appear). + defaults so newly-added columns still appear). The prep deck's main-waveform + zoom persists the same way (`mainZoomSec`, hydrated in `PrepStrip` from the + shared `['prefs']` query). ## Commands @@ -157,7 +163,7 @@ frontend at `http://localhost:5173`. - ✅ Track prep — audio playback, frequency-colored scrolling waveform, scratch, beatgrid display + editing, cue/hotcue create/jump/delete, loops; keyboard shortcuts (Space = play/pause, 1–8 = hotcues, Shift+1–8 = delete). See "Prep engine". -- ⬜ Track prep Tier 2 — cue-point fine editing / audio export polish +- ✅ Track prep Tier 2 — cue-point fine editing / audio export polish - ⬜ Bulk metadata editing; ⬜ Phase 4 — polish + optional Tauri desktop packaging ## Write path (playlists + track metadata + prep) diff --git a/README.md b/README.md index 0cdcaf7..f5153dc 100644 --- a/README.md +++ b/README.md @@ -43,20 +43,28 @@ file Traktor uses, so everything you do shows up next time you open Traktor. ## Getting started Konduktor runs as two small local servers (a Python backend and a web -frontend). One-time setup, then a single command to launch. +frontend). Do the one-time setup, then start them — the same steps work on +macOS, Linux, and Windows. ### 1. Install (once) -**Backend** — needs Python 3.11+: +**Backend** — needs Python 3.11+. Create a virtual environment and install the +dependencies: ```bash cd backend -python3 -m venv .venv && source .venv/bin/activate +python3 -m venv .venv # Windows: python -m venv .venv +``` + +Activate it, then install: + +```bash +source .venv/bin/activate # Windows (PowerShell): .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt cd .. ``` -**Frontend** — needs Node 18+: +**Frontend** — needs Node 18+ (same on every platform): ```bash cd frontend @@ -66,14 +74,28 @@ cd .. ### 2. Run it (development) +Konduktor runs as two local servers (backend on `:8000`, frontend on `:5173`). + +**macOS / Linux** — one command starts both: + ```bash ./dev.sh ``` -This starts both servers; open **http://localhost:5173** in your browser. Press -`Ctrl-C` to stop. This is the fastest way to try Konduktor or hack on it — the -frontend hot-reloads as you edit. To package a real double-clickable app -instead, see [Build a standalone app](#build-a-standalone-app-production) below. +**Windows** — start each server in its own terminal: + +```powershell +# Terminal 1 — backend +cd backend; .\.venv\Scripts\Activate.ps1; uvicorn konduktor.main:app --reload --port 8000 + +# Terminal 2 — frontend +cd frontend; npm run dev +``` + +Either way, open **http://localhost:5173** in your browser (`Ctrl-C` stops a +server). This is the fastest way to try Konduktor or hack on it — the frontend +hot-reloads as you edit. To package a real double-clickable app instead, see +[Build a standalone app](#build-a-standalone-app-production) below. ### 3. Open your collection @@ -100,38 +122,55 @@ On top of the Python 3.11+ and Node 18+ from above: - **Rust** — install from (the app shell is Tauri/Rust). - **PyInstaller** — into the backend venv: `pip install -r backend/requirements-build.txt` +- **Windows only:** also the MSVC C++ build tools and the WebView2 runtime — see + [BUILDING-WINDOWS.md](BUILDING-WINDOWS.md) for the one-time toolchain setup. -### macOS +The build is a two-step recipe on both platforms: **freeze the backend into a +sidecar binary**, then **build the app**. The only difference is which sidecar +script you run — `.sh` on macOS/Linux, `.ps1` on Windows. Each build runs on its +own OS (the app can't be cross-compiled). + +### macOS / Linux ```bash -# 1) Freeze the backend into a sidecar binary (run from the backend venv) -cd backend && source .venv/bin/activate -./build_sidecar.sh -cd .. +# 1) Freeze the backend into a sidecar binary (from the activated backend venv) +cd backend && source .venv/bin/activate && ./build_sidecar.sh && cd .. # 2) Build the app -cd frontend -npx tauri build +cd frontend && npx tauri build ``` -You'll get an installer at +The installer lands at `frontend/src-tauri/target/release/bundle/dmg/Konduktor__aarch64.dmg` -(with the `.app` beside it). Builds are currently **unsigned**, so the first -launch needs a right-click → **Open** to get past Gatekeeper. The `.dmg` is -Apple-Silicon (`aarch64`) only. - -> **Faster local builds:** `npx tauri build --debug --bundles app` skips the -> optimizer and the `.dmg`, giving you a runnable `.app` in seconds — handy while -> iterating. +(with the `.app` beside it). ### Windows -Windows can't be cross-built from macOS — the (near-identical) steps to run on a -Windows machine are in **[BUILDING-WINDOWS.md](BUILDING-WINDOWS.md)**. +```powershell +# 1) Freeze the backend into a sidecar binary (from the activated backend venv) +cd backend; .\.venv\Scripts\Activate.ps1; .\build_sidecar.ps1; cd .. + +# 2) Build the app +cd frontend; npx tauri build +``` + +The installers land in `frontend\src-tauri\target\release\bundle\` (an `.msi` and +an NSIS `-setup.exe`). See [BUILDING-WINDOWS.md](BUILDING-WINDOWS.md) for the full +walkthrough and Windows-specific notes. + +> **Note:** builds are currently **unsigned**, so the first launch is flagged by +> the OS — on macOS right-click → **Open** to get past Gatekeeper; on Windows +> click **More info → Run anyway** past SmartScreen. The macOS `.dmg` is +> Apple-Silicon (`aarch64`) only. + +> **Faster local builds:** `npx tauri build --debug --bundles app` skips the +> optimizer and the installer, giving you a runnable app in seconds — handy while +> iterating. ### Rebuilding after changes -Changed **backend** Python? Re-run `./build_sidecar.sh`, then `npx tauri build`. +Changed **backend** Python? Re-run the sidecar script for your OS +(`./build_sidecar.sh` or `.\build_sidecar.ps1`), then `npx tauri build`. Frontend-only change? Just `npx tauri build` — it rebuilds the web app for you. --- diff --git a/frontend/src/components/GridControls.tsx b/frontend/src/components/GridControls.tsx index 5f9f353..9b9a311 100644 --- a/frontend/src/components/GridControls.tsx +++ b/frontend/src/components/GridControls.tsx @@ -5,6 +5,7 @@ interface Props { locked: boolean hasGrid: boolean onSetBpm: (bpm: number) => void + onNudgeBpm: (delta: number) => void onHalve: () => void onDouble: () => void onNudge: (deltaMs: number) => void @@ -20,15 +21,17 @@ const BTN = 'disabled:hover:border-line' /** - * Beatgrid / tempo panel (Traktor grid-control equivalent): editable BPM, half/ - * double, tap tempo, grid-phase nudge (±1/±10 ms), set beat 1 at the playhead, - * reset to the loaded values, lock, and delete grid. + * Beatgrid / tempo panel (Traktor grid-control equivalent): editable BPM, BPM + * nudge (fine ±0.01 / coarse ±0.25), half/double, tap tempo, grid-phase nudge + * (±1/±10 ms), set beat 1 at the playhead, reset to the loaded values, lock, + * and delete grid. */ export function GridControls({ bpm, locked, hasGrid, onSetBpm, + onNudgeBpm, onHalve, onDouble, onNudge, @@ -91,6 +94,45 @@ export function GridControls({
BPM
+ {/* BPM nudge — coarse ±0.25 (outer) / fine ±0.01 (inner) */} +
+ + BPM + + + + + +
+ {/* halve / double / tap / reset */}