Skip to main content

max / audiofiles

Docs: correct migration count, RF model size, shared-lib path Verified against the code: - 19 inline migrations (MIGRATION_001..019 in db.rs), was 12/18. - layer2_drum.json is 3.9 MB (rounds to 4.0), was 7.4 MB. - ../../MNW/shared/ relative path for Apps/audiofiles, was ../MNW/shared/. - spelling: specialisations -> specializations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-06-07 19:24 UTC
Commit: a52d63275c89f89af850e432740ddffa736d592a
Parent: f2c413a
6 files changed, +7 insertions, -7 deletions
M README.md +1 -1
@@ -39,7 +39,7 @@ Six crates:
39 39
40 40 Dependency flow: `audiofiles-core` is the leaf -> `audiofiles-rhai` and `audiofiles-sync` depend on core -> `audiofiles-browser` depends on core, sync, and rhai -> `audiofiles-app` depends on browser and core. `audiofiles-train` depends on core only.
41 41
42 - Shared libraries from `../MNW/shared/`: [theme-common](../MNW/shared/theme-common/) (theme loading), [synckit-client](../MNW/shared/synckit-client/) (cloud sync SDK).
42 + Shared libraries from `../../MNW/shared/`: [theme-common](../../MNW/shared/theme-common/) (theme loading), [synckit-client](../../MNW/shared/synckit-client/) (cloud sync SDK).
43 43
44 44 ## Features
45 45
@@ -51,7 +51,7 @@ The VFS layer maps user-visible paths to content hashes. A single sample blob ca
51 51
52 52 ## Database Schema
53 53
54 - SQLite with 12 versioned migrations:
54 + SQLite with 19 versioned migrations:
55 55
56 56 | Table | Purpose |
57 57 |-------|---------|
@@ -81,7 +81,7 @@ The analysis system in `audiofiles-core::analysis` decodes audio to mono f32 via
81 81 - **BPM**: Onset-based tempo estimation using spectral flux and autocorrelation.
82 82 - **Key**: Musical key detection from chroma features.
83 83 - **MFCC**: Mel-Frequency Cepstral Coefficients computed from existing STFT magnitudes (26-band mel filterbank, log energy, DCT-II, 13 coefficients). Aggregated as mean + variance across frames (26 features total).
84 - - **Classification**: Two-layer ML system mapping 35-feature vectors (9 spectral/waveform + 26 MFCC) to 16 sample categories (kick, snare, hihat, cymbal, percussion, bass, vocal, synth, pad, fx, noise, music, ambience, impact, foley, texture). Layer 1: rule-based broad classifier detects drums vs non-drum categories. Layer 2: 200-tree Random Forest (7.4MB, embedded via `include_bytes!`, `OnceLock` lazy init) for drum sub-classification (kick/snare/hihat/cymbal/percussion). Confidence scores from RF vote fraction. 94.4% strict accuracy on 4343 labeled drum samples. Training binary in `audiofiles-train` crate (not built by default).
84 + - **Classification**: Two-layer ML system mapping 35-feature vectors (9 spectral/waveform + 26 MFCC) to 16 sample categories (kick, snare, hihat, cymbal, percussion, bass, vocal, synth, pad, fx, noise, music, ambience, impact, foley, texture). Layer 1: rule-based broad classifier detects drums vs non-drum categories. Layer 2: 200-tree Random Forest (4.0MB, embedded via `include_bytes!`, `OnceLock` lazy init) for drum sub-classification (kick/snare/hihat/cymbal/percussion). Confidence scores from RF vote fraction. 94.4% strict accuracy on 4343 labeled drum samples. Training binary in `audiofiles-train` crate (not built by default).
85 85 - **Loop detection**: Identifies whether a sample is a seamless loop.
86 86 - **Fingerprinting**: Computes an amplitude envelope fingerprint for near-duplicate detection across the library.
87 87 - **Tag suggestion**: Generates tag suggestions from analysis results (classification, BPM range, key, duration bracket) with confidence scores and human-readable reasons.
@@ -1,6 +1,6 @@
1 1 # audiofiles Database Schema
2 2
3 - SQLite schema reference. 18 inline migrations. Migrations are embedded as Rust string constants in `crates/audiofiles-core/src/db.rs` and applied via `PRAGMA user_version` tracking -- not separate SQL files.
3 + SQLite schema reference. 19 inline migrations. Migrations are embedded as Rust string constants in `crates/audiofiles-core/src/db.rs` and applied via `PRAGMA user_version` tracking -- not separate SQL files.
4 4
5 5 ## Domain Map
6 6
@@ -20,7 +20,7 @@
20 20
21 21 1. **No `Color32::from_rgb(...)` outside `theme.rs`.** Test by `grep -rE 'Color32::(from_rgb|WHITE|BLACK|GRAY|RED|GREEN|BLUE|YELLOW|DARK_GRAY)' src/ui/ | grep -v theme.rs` — must be empty.
22 22 2. **No raw `add_space(N.0)` outside `widgets.rs` and `theme.rs`** — use named spacing tokens (§Spacing).
23 - 3. **No inline `selectable_label(active, RichText::new(label).strong().color(accent_blue()))`** — use `widgets::selectable_row` or one of its specialisations.
23 + 3. **No inline `selectable_label(active, RichText::new(label).strong().color(accent_blue()))`** — use `widgets::selectable_row` or one of its specializations.
24 24 4. **No inline `Window::new(...).collapsible(false).resizable(false).anchor(CENTER_CENTER, [0,0])`** — use `widgets::modal_window` or `widgets::confirm_modal`.
25 25 5. **No emoji or checkmark glyphs in user-facing strings** (CLAUDE.md brand rule). Use words. Test by `grep -rE '\\u\{1F[0-9A-Fa-f]{3}\}|\\u\{2[0-9A-Fa-f]{3}\}'` against UI files — flagged glyphs require a documented exception comment.
26 26
@@ -110,7 +110,7 @@ Binary: `crates/audiofiles-train/src/main.rs` (not built by default).
110 110
111 111 ### Output
112 112
113 - - Model file: `crates/audiofiles-core/models/layer2_drum.json` (7.4 MB)
113 + - Model file: `crates/audiofiles-core/models/layer2_drum.json` (4.0 MB)
114 114 - Format: JSON array of 200 trees + class metadata
115 115 - Each tree node is either a `Split { feature, threshold, left, right }` or `Leaf { class }`
116 116
@@ -91,7 +91,7 @@ AND hash NOT IN (SELECT DISTINCT sample_hash FROM collection_members WHERE sampl
91 91
92 92 **Database location:** `~/.config/audiofiles/audiofiles.db` (platform-dependent)
93 93
94 - **18 inline migrations** tracked via `PRAGMA user_version`. Run automatically on app startup.
94 + **19 inline migrations** tracked via `PRAGMA user_version`. Run automatically on app startup.
95 95
96 96 | Symptom | Cause | Fix |
97 97 |---------|-------|-----|