Identical audio is analyzed ONCE and served forever. This is the economic core that makes cheap-analysis-at-scale viable, and it makes the live emotion endpoint feel instant on repeats. WHY: per the design, repeat calls must cost ~nothing — that's the margin story vs cloud egress. A re-analyzed track shouldn't pay the CLAP compute twice. WHAT: - cache.py — content_id = sha256 of DECODED PCM (+ samplerate) so re-encodes / re-uploads of the same sound dedupe; raw-bytes fallback for formats we can't decode here. params_hash folds engine settings (model, bars…) so different params cache separately. get/put (JSON inline or a result_ref path for big artifacts), yt-id/url → content_id aliases (#29 will use them), and an LRU/size-cap gc() that unlinks evicted artifact files (cache is transient on the freebox — rebuildable). - db.py — cache + aliases tables (WAL already on), LRU index on (kind, last_access). - app.py — /v1/analyze/emotion now content-addresses the upload, serves cached reads with X-Douanier-Cache: hit, computes+stores on miss. Engine call still behind engines.ears (unchanged contract). - douanier.py — cache stats / gc admin commands. VALIDATION: - 22/22 tests green (+7 cache: stable/decode-invariant content id, raw fallback, miss→put→hit, params separate entries, hit counter, alias resolve, LRU gc spares the recently-touched entry). - Real-CLAP end-to-end: same clip twice → call 1 miss 10.6s, call 2 hit 0.002s = 5663x speedup, identical V/A. The headline product benefit, measured.
| Name |
Last commit
|
Last update |
|---|---|---|
| armada | Loading commit data... | |
| blocks | Loading commit data... | |
| blog | Loading commit data... | |
| copycat | Loading commit data... | |
| gifts | Loading commit data... | |
| lib-parvagues | Loading commit data... | |
| live | Loading commit data... | |
| output | Loading commit data... | |
| releases | Loading commit data... | |
| sandbox | Loading commit data... | |
| study | Loading commit data... | |
| test | Loading commit data... | |
| tools | Loading commit data... | |
| utils | Loading commit data... | |
| viz | Loading commit data... | |
| .gitignore | Loading commit data... | |
| BootTidal.hs | Loading commit data... | |
| BootTidal.hs.broken | Loading commit data... | |
| BootTidal.visuals.broken.hs | Loading commit data... | |
| CLAUDE.md | Loading commit data... | |
| LICENSE | Loading commit data... | |
| PatchBay_MultiChannel.xml | Loading commit data... | |
| PatchBay_Perf.xml | Loading commit data... | |
| PatchBay_Perf5.1.xml | Loading commit data... | |
| README.md | Loading commit data... | |
| backlog.md | Loading commit data... | |
| bullet_train.tidal | Loading commit data... | |
| collide.sh | Loading commit data... | |
| debug.tidal | Loading commit data... | |
| didacticpatternvisualizer.pde | Loading commit data... | |
| hello.sc | Loading commit data... | |
| init_midi.sh | Loading commit data... | |
| intro.md | Loading commit data... | |
| library.txt | Loading commit data... | |
| link_jack.sh | Loading commit data... | |
| link_samples.sh | Loading commit data... | |
| link_samples_all.txt | Loading commit data... | |
| main_fairbanks.scd | Loading commit data... | |
| notes.md | Loading commit data... | |
| perf-tray.py | Loading commit data... | |
| perf.sh | Loading commit data... | |
| samples.txt | Loading commit data... | |
| start_and_midi.scd | Loading commit data... | |
| test.tidal | Loading commit data... |