Ears for coding agents: let AI hear, review and make sound. CPU-only, open source.
earshot 0.2.0: forge v2 and earshot fit
Leonxlnx972132643583
diff --git a/CHANGELOG.md b/CHANGELOG.mdnew file mode 100644index 0000000..22ed498--- /dev/null+++ b/CHANGELOG.md@@ -0,0 +1,65 @@+# Changelog++## 0.2.0 - 2026-10-16++forge v2 and `earshot fit`.++### Added++- **`earshot fit`: audio to code.** Fits a small synthesis model (ringing modes, tracked partials, a time-varying+ noise gesture, or a layered hybrid of them) to a recording by analysis by synthesis, and writes it as a readable+ forge recipe module whose `render()` makes the sound. The module stores the structure of the sound, not its+ samples: new takes per seed, knobs for variations, `--morph A B` between two fits of one kind, `--forge` for+ critic-searched variations. On 12 real references: median CLAP cosine 0.945 between recording and render (minimum+ 0.881), the same top `earshot describe` tag in 10 of 12. In our 12-trial blind test the listener could not tell+ the recordings from the renders (one listener: a small test). Method, numbers and limits:+ [docs/FIT.md](docs/FIT.md).+- **forge v2.**+ - Reference sets (`earshot/forge/refsets.py`): 18 motion-design categories, split by source into a 'forge' side the+ search may use (81 refs) and a 'bench' side it never hears (71 refs). The recordings stay local.+ - A fixed held-out benchmark (`eval/forge/bench.py`): tone, envelope, independent phrasings, AudioSet names,+ artifacts and variety, next to the same checks for real recordings. Results per round in `eval/forge/`.+ - Critic v2: model-free penalties for tonal balance, the spectro-temporal envelope, artifacts and polish; a designed+ mode for categories without real references. `version=1` reproduces v1.+ - Search v2: model-free pre-screen, CMA-ES option, threaded renders, robust re-renders, seed bank,+ `report.md` / `compare.png` / audition reel, `forge(families=)` and `palette()`.+ - DSP toolkit: `earshot/forge/dsp.py` (sources) and `earshot/forge/fx.py` (effects).+ - 34 categories as families of named characters, 4-6 variants each: 18 real-recording categories and 16 `pro_*`+ designed ones.+ - One report schema (`earshot/forge/schema.py`) and `earshot forge --check`: every pick re-renders from its+ `report.json`.+ - The pro motion-SFX study: 58 designed effects measured in 8 professional launch films (anonymous ids, nothing+ redistributed) and a cited technique note (`docs/motion-sfx-study.md`, `docs/motion-sfx-techniques.md`,+ `eval/forge/pro/`).+ - A clean blind-test kit (`eval/forge/blind_v2.py`): loudness-matched, randomised trials of made sounds against+ held-out recordings, answer sheet, sealed key, scorer, and a cleanliness report that stops the build on a fail.+ - `eval/forge/scrub_paths.py`: removes machine paths from results; `bench.py` writes scrubbed paths.+- **`earshot gallery`**: one static HTML listening page for forge outputs (players, spectrograms, loudness, critic and+ benchmark numbers, parameters), with `--compare`, `--embed` and `--embed-compressed`.++### Changed++- The `earshot forge` CLI defaults are the v2 setup: pre-screen, seed bank, robust re-renders with a shortlist, the+ critic v2 tone weight, and the recipe's reference set as default refs. The Python `forge()` defaults still+ reproduce v1.+- forge v1 -> v2 on the held-out benchmark, in the five categories v1 had: variants are no longer near copies (CLAP+ cosine between variants 0.89-0.97 -> 0.71-0.85), tails that died too fast reach the real length (click 0.56 -> 1.44+ x the bench median, fast whoosh 0.51 -> 0.88), tone balance closer in 3 of 5. All numbers:+ [docs/FORGE_V2.md](docs/FORGE_V2.md).+- The launch film was re-scored with forge v2 sounds (in its own project; no media here): `earshot critique` 16 -> 19+ of 22 metrics in range, realness 0.73 -> 0.84, cues with an onset within one frame 86 -> 98 % of 43; -14.0 LUFS,+ true peak -2.2 dBTP.++### Known limits++- No blind-test score for the forge v2 sounds is published yet.+- `earshot fit`'s selection weights were set on the same 12 references they were measured on; risers, zips and long+ designed sounds are untested.++## 0.1.0 - 2026-10-16++First public release. `describe`, `match`, `rank`, `find`, `compare` / `ab`, `realness`, `timeline`, `sheet`,+`critique`, `profile`, `measure`, `forge` (v1: five recipes), the optional `llm` critique (own key, explicit consent),+`mcp` and `doctor`, as a CLI, a Python API and an MCP server, on CPU. The `earshot` and `real-sound` agent skills,+held-out evaluations ([docs/VALIDATION.md](docs/VALIDATION.md)) and limits ([docs/LIMITS.md](docs/LIMITS.md)). The+22 s launch film, every sound made with `earshot forge`.diff --git a/README.md b/README.mdindex 4ca35d6..aef7a47 100644--- a/README.md+++ b/README.md@@ -17,7 +17,8 @@ description, the best moment inside a long recording, whether it is a real recorsecond-by-second listening transcript of a whole film, an annotated picture of it, and a scorecard againstprofessional launch films. It runs locally on CPU, as a CLI, a Python API and an MCP server.-With ears, an agent can also **make its own sounds in code** and improve them by listening (`earshot forge`, below).+With ears, an agent can also **make its own sounds in code** and improve them by listening (`earshot forge`), and+**translate a recording into code** it can vary (`earshot fit`). Both below.```$ earshot describe enter.ogg@@ -50,6 +51,8 @@ $ earshot critique film.mp4| `profile REFS... -o p.json` | build your own reference profile from films you admire || `measure FILE` | objective measurements only (no models): LUFS, true peak, LRA, envelope, spectrum, tempo / key || `forge RECIPE --refset CAT` | make a sound in code and improve it by listening (see below) |+| `fit FILE -o recipe.py` | translate a recording into a forge recipe module that re-renders it, with knobs and morphs (see below) |+| `gallery DIR -o page.html` | one static HTML listening page of forge outputs: players, spectrograms, numbers || `llm FILE --yes-upload` | optional audio-LLM critique (Gemini), only with your own key and explicit consent || `mcp` | the same tools as an MCP server for Claude Code and other agents || `doctor [--load]` | check the install, models, data files and CPU settings |@@ -97,19 +100,24 @@ search may use and a 'bench' side only the fixed benchmark (`eval/forge/bench.py`earshot/forge/fx.py` (reverb, saturation, transient shaping, limiter, EQ match, Doppler, filters, glitch, granular).In Python: `from earshot.forge import forge`.-**forge v2 (branch `forge-v2`, not merged yet).** Recipes come as families of named characters: 34 motion-design-categories (whooshes, swishes, swipes, risers, downlifters, zips, impacts, sub drops, logo stings, clicks, taps,-toggles, hover ticks, pops, notification dings, shimmers, glitches, key presses), 16 of them modelled on the designed-effects of professional launch films, 4-6 variants each. A fixed benchmark scores them against held-out recordings the-forge never heard. Against v1 on it (round 6): variants are no longer near copies (CLAP cosine between-variants 0.89-0.97 -> 0.71-0.85 in the five categories v1 had; real sets 0.52-0.77), tails that died too fast now-reach the real length (click t40 0.56 -> 1.44 x the bench median, fast whoosh 0.51 -> 0.88), and the tonal balance is-closer in 3 of those 5 (key press 8.2 -> 7.4 dB, fast whoosh 8.6 -> 6.2, impact 6.7 -> 4.4). Across all 34, the made-balance is at least as close to the held-out recordings as a second set of real recordings in 18 of the 21-categories that have a number, and every final re-renders from its `report.json`. The model checks that v1 had-saturated fell. Nobody had listened to the v2 sounds when this was written; a new blind test is built and waiting.-What changed, every number, and what is still weak:-[docs/FORGE_V2.md](docs/FORGE_V2.md).+**forge v2 (0.2.0).** Recipes come as families of named characters: 34 motion-design categories (whooshes, swishes,+swipes, risers, downlifters, zips, impacts, sub drops, logo stings, clicks, taps, toggles, hover ticks, pops,+notification dings, shimmers, glitches, key presses), 16 of them modelled on the designed effects of professional+launch films ([docs/motion-sfx-study.md](docs/motion-sfx-study.md)), 4-6 variants each. A fixed benchmark scores them+against held-out recordings the forge never heard. Against v1 on it: variants are no longer near copies (CLAP cosine+between variants 0.89-0.97 -> 0.71-0.85 in the five categories v1 had; real sets 0.52-0.77), tails that died too fast+now reach the real length (click t40 0.56 -> 1.44 x the bench median, fast whoosh 0.51 -> 0.88), and the tonal+balance is closer in 3 of those 5 (key press 8.2 -> 7.4 dB, fast whoosh 8.6 -> 6.2, impact 6.7 -> 4.4). Across all+34, the made balance is at least as close to the held-out recordings as a second set of real recordings in 18 of the+21 categories that have a number, and every final re-renders from its `report.json` (`earshot forge --check`). The+model checks that v1 had saturated fell. A clean blind-test kit for the v2 sounds is `eval/forge/blind_v2.py`; no v2+score is published yet. What changed, every number, and what is still weak: [docs/FORGE_V2.md](docs/FORGE_V2.md).++The reference recordings are licensed and not in this repo, so `--refset` needs a local registry: bring your own refs+with `--refs DIR`, or lay them out as described in `earshot/forge/refsets.py`. Without refs the critic runs in+designed mode (realness reported, not required). The CLI defaults changed in 0.2.0 (pre-screen, seed bank, robust+re-renders, the recipe's reference set); the Python `forge()` defaults still reproduce v1. See+[CHANGELOG.md](CHANGELOG.md).**Blind test (v1 recipes).** A key press, a UI click, a pop, a fast whoosh and an impact were made from scratch incode and played blind next to real recordings of the same kind of sound. The author picked the made one correctly **8 times out@@ -122,17 +130,41 @@ stop telling made from real; the 1/3-octave measurement still can. The realnessresonator plus a room and a noise floor reads "real"). Judge a made sound by the model-free measurements,spectrograms next to the references, robust re-renders, and a human blind test.+## earshot fit: audio to code++`earshot fit` translates a recording into code by analysis by synthesis. It fits a small synthesis model with readable+parameters (ringing modes, tracked partials, a time-varying noise gesture, or a layered hybrid of them) until its+render matches the recording, then writes the model as a forge recipe module whose `render()` makes the sound. The+module stores the structure of the sound, not its samples, so it can make new takes, variations (size, damping,+pitch, brightness, decay, ...) and morphs between two recordings.++```bash+earshot fit click.wav -o made/click_fit.py --report # recipe + its render + side-by-side spectrogram + metrics+python made/click_fit.py 3 take3.wav # the module renders on its own (seed 3)+earshot fit --morph a.wav b.wav --amount 0.5 -o made/ab_morph.py+earshot fit --forge made/click_fit.py --budget 96 --dir made/click_variations # critic-searched variations+```++Measured on 12 real recordings (2 each of click, key press, pop, impact, fast whoosh, notification): median CLAP+cosine 0.945 between each recording and the render of its generated code (minimum 0.881), and the same top+`earshot describe` tag in 10 of 12. In our 12-trial blind test (recording vs render, loudness-matched, random order)+the listener could not tell which clip was the recording. One listener is a small test, not a proof. The renders are+close, not identical: onsets, tone balance and noise texture still differ measurably; the selection weights were set+on the same 12 recordings; risers, zips and long designed sounds are untested. A fit is a derivative of its recording,+so keep the source's licence with the recipe. Limits: [docs/FIT.md](docs/FIT.md#limits-honest).+## Gallery`earshot gallery` turns forge outputs into one static HTML page for people with ears: no server, no network, noexternal scripts, inline CSS. One card per category, grouped by family (whooshes, sweeps, impacts, UI, tonal,digital); per sound a player, a spectrogram thumbnail (log frequency, one time span per card so lengths compare),duration, peak and momentary-max LUFS, the critic's total / pass, and the recipe parameters of every variant in a-collapsible table.+collapsible table. The repo holds no audio, so point it at your own forge runs (`out/forge_v2` below is one folder+per category).```bashearshot gallery out/forge_v2 -o out/gallery/gallery.html # <category>/final/*.wav (+ report.json)-earshot gallery out/forge_v2 -o g.html --results eval/forge/results_v2r2.json # + held-out benchmark numbers+earshot gallery out/forge_v2 -o g.html --results eval/forge/results_v2r6.json # + held-out benchmark numbersearshot gallery out/forge_v2 -o g.html --refs forge # + A/B row: each sound's nearest forge refearshot gallery --compare "r2:out/forge_v2/*/final_r2" "r3:out/forge_v2/*/final" -o compare.html \--results r2:eval/forge/results_v2r2.json # before / after, variant under variant@@ -239,10 +271,12 @@ style of the 7 films behind it, not every good film. Details in [docs/LIMITS.md]```earshot/ the package: CLI, Python API, MCP server, CPU model wrappersforge/ make sounds in code: DSP building blocks, critic, model-free tone checks, search, recipes/+ fit/ recording -> code: modal / sines / spectral fitters, quality metrics, recipe codegen+ gallery.py the static listening pagedata/ vocabulary + calibration stats, realness model weights, launch profile (numbers only, no media)skills/earshot/ agent skill: how to listen with earshotskills/real-sound/ agent skill: real-recordings soundtracks (scripts, templates, prompts, references)-docs/ VALIDATION, LIMITS, launch-video sound playbook, integration notes, design notes+docs/ VALIDATION, LIMITS, FORGE_V2, FIT, the motion-SFX study, launch-video playbook, design noteseval/ evaluation scripts and results per area (see eval/README.md)tests/ pytest (fast by default; --slow loads the models)```diff --git a/docs/FIT.md b/docs/FIT.mdindex 58c9a31..9f5b2ae 100644--- a/docs/FIT.md+++ b/docs/FIT.md@@ -16,7 +16,7 @@ On 12 real references, the renders of the generated code sit close to the origin- `earshot describe` gives the same top tag for both in 10 of 12.They are close but not identical: measured differences remain in onsets, tone balance and noise texture, listed-below. Whether ears can tell them apart is what the mini blind test is for (`out/fit/blind_fit/`, below).+below. In the mini blind test (below) the listener could not tell the recordings from the renders.## How it works@@ -125,8 +125,9 @@ The **12 forge-split refs** (never bench) are 2 each of click, typing_key, pop,first file of each category and the first from another source.For each ref: every candidate was fitted, the engine chose (with `--clap`), the recipe module was written and-imported, and **its** render (seed 0) was measured. Results are in `out/fit/validation/` (`summary.md`,-`all_metrics.json`, `<category>/<stem>/pair.png`, the recipe modules, the WAVs).+imported, and **its** render (seed 0) was measured. Results are in `out/fit/validation/` on the dev machine+(`summary.md`, `all_metrics.json`, `<category>/<stem>/pair.png`, the recipe modules, the WAVs; local, because they+are derived from licensed recordings).| category | ref | chosen | mel dB (floor) | env r | tone dB | onset err | excess dB | CLAP (floor) ||---|---|---|---|---|---|---|---|---|@@ -196,6 +197,10 @@ Trim, level and the cleanliness checks are the clean blind test's own: `out/fit/After listening: `.venv\Scripts\python.exe out\fit\blind_fit\score_answers.py A B ...` (12 letters). 10 or moreright is unlikely by luck (p = 0.019).+**Result:** one listener took the test and could not tell the recording from the render; both clips of a trial+sounded the same to them. One listener and 12 trials is a small test, not a proof. The kit stays local, because it+plays licensed recordings.+## Morph examples`out/fit/morphs/` has three morphs:diff --git a/docs/FORGE_V2.md b/docs/FORGE_V2.mdindex 5e23e66..6922b97 100644--- a/docs/FORGE_V2.md+++ b/docs/FORGE_V2.md@@ -1,5 +1,9 @@# forge v2: review notes for the `forge-v2` branch+> Released in 0.2.0 ([CHANGELOG.md](../CHANGELOG.md)). These notes were written on the branch before the merge, so+> "not merged" and "nobody has listened" below describe that time. Paths under `out/` are local to the dev machine:+> the made sounds, galleries and blind-test kits hold audio, and the reference recordings are licensed.+What changed in `earshot forge` during the overnight iteration of 2026-10-16, how to try it, what the held-outmeasurements say, what is still weak, and what to check before merging. The branch is not merged; `main` isuntouched. The round-by-round log with every number is [OVERNIGHT.md](../OVERNIGHT.md). Per-category verdicts are indiff --git a/earshot/__init__.py b/earshot/__init__.pyindex e1a76d3..5542aaa 100644--- a/earshot/__init__.py+++ b/earshot/__init__.py@@ -12,7 +12,7 @@ or explicitly: `from earshot import api` / `from earshot.describe import describ"""import importlib-__version__ = '0.1.0'+__version__ = '0.2.0'# modules that are callable as their main function (see _callable.py)_CALLABLE = {'describe', 'match', 'compare', 'realness', 'timeline', 'sheet', 'critique', 'profile'}diff --git a/pyproject.toml b/pyproject.tomlindex f8a0eb7..d5471a8 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "earshot"-version = "0.1.0"+version = "0.2.0"description = "Ears for coding agents: describe, match, search, compare, time-align and critique sound files an agent cannot hear."readme = "README.md"requires-python = ">=3.10"