Skip to content

Ears for coding agents: let AI hear, review and make sound. CPU-only, open source.

Study: pro motion-design SFX measured from reference films + online technique research

Leonxlnx1cff4aa7af0b
diff --git a/docs/motion-sfx-study.md b/docs/motion-sfx-study.md
new file mode 100644
index 0000000..5e87eb4
--- /dev/null
+++ b/docs/motion-sfx-study.md
@@ -0,0 +1,270 @@
+# What professional motion-design SFX are made of
+
+A measured study of the sound design in eight professional launch / motion films (third-party, kept local, called
+ref_1 .. ref_8 here), done to give earshot forge concrete targets: what a "pro designed" whoosh, riser, impact, click,
+pop or sting actually looks like in numbers, and how it sits against music and picture.
+
+Tools: `eval/forge/pro/` (earshot timeline at detail high + sheet per film, paged spectrogram overviews, zoomed crops,
+bed-subtracted measurements, trims). Local data: `out/refs_pro/` (never committed: trims, `manifest.json`,
+`registry.json`, `stats.json`, `films.json`, sheets and crops under `_work/`).
+
+## How to read the numbers (and how far to trust them)
+
+- **58 events** were picked by looking: earshot sheets, 8 s overview pages, then zoomed crops of every candidate.
+ Only events that stand out over the bed were kept (an exposed accent, or an SFX-only stretch).
+- **One film dominates.** ref_2 is a pure sound-design piece with no music bed; it supplies 39 of the 58 events and
+ most of the clean ones. The other seven are music- or voice-led, and their effects are sparse or buried. The
+ per-category numbers below are often 1-10 examples from 1-2 films: they are measurements of real pro work, not
+ population statistics.
+- **Bed subtraction.** Each event is measured as (event power - bed power), with the bed taken as the quietest 150 ms
+ in the 0.6 s before the event (`measure.quiet_bed`, so a run of clicks or a previous hit does not count as bed). Bands
+ where the event adds under 1 dB are marked masked and left out of the spectral medians. Over a music bed this
+ removes most of the music, not all of it.
+- **Levels** are K-weighted (BS.1770 filter): `over_bed` = loudest 100 ms of the event minus the quiet bed. Because
+ the bed is the *quietest* stretch between beats, the figure reads a few dB higher than "over the average music level".
+ A silent bed counts as -70 LUFS.
+- **Balance** = bed-subtracted power per 1/3-octave band in dB relative to the event's own total (level never decides).
+ `tilt` = least-squares slope of that balance from 100 Hz to 10 kHz, in dB per octave.
+- **Attack** = from the first millisecond within 20 dB of the peak to the peak (1 ms bed-subtracted envelope).
+ `t20` / `t40` = peak to the first fall 20 / 40 dB under it (10 ms smoothing). Decay shape: `convex` = holds, then drops
+ (a gate or a fade), `exp` = straight in dB, `concave` = drops fast, then a long tail.
+- **Pitch** = the dominant spectral ridge (or the centroid for noise). Where a film's tonal music sat under a zip, the
+ automatic ridge locked onto the music, and the sweep was read off the zoomed spectrogram instead (marked *read*).
+- All audio is the films' decoded AAC at 48 kHz stereo.
+
+## The films: music first, effects placed
+
+| film | dur s | LUFS | LRA | cuts/s | beat | voice-over | cuts with an onset within 1 frame (chance) | strong accent within 1 frame (chance) |
+|---|---|---|---|---|---|---|---|---|
+| ref_1 | 20.5 | -10.4 | 6.4 | 0.78 | 107 BPM, weak | yes | 31% (35%) | 6% (8%) |
+| ref_2 | 29.5 | -22.2 | 12.2 | 0.54 | none | no | 50% (44%) | 19% (10%) |
+| ref_3 | 49.3 | -17.4 | 5.5 | 0.63 | 133 BPM, weak | yes | 58% (46%) | 16% (9%) |
+| ref_4 | 8.7 | -23.1 | 0.7 | 1.71 | 111 BPM, clear | no | 20% (20%) | 7% (4%) |
+| ref_5 | 28.9 | -14.8 | 3.6 | 0.31 | none | yes | 67% (46%) | 22% (9%) |
+| ref_6 | 32.3 | -14.8 | 7.0 | 1.27 | 122 BPM, clear | no | 81% (71%) | 22% (15%) |
+| ref_7 | 41.8 | -7.3 | 3.3 | 1.60 | 92 BPM | no | 33% (31%) | 4% (7%) |
+| ref_8 | 93.1 | -12.1 | 1.7 | 0.30 | none | yes | 71% (60%) | 25% (11%) |
+
+What this says:
+- **Six of eight films let the music (and the voice) carry the cut rhythm.** Their cuts have some onset within a
+ frame 20-81% of the time against a chance level of 20-71% (a few points above chance; ref_5 is the clearest at 67%
+ vs 46%), and a strong accent within a frame only 4-25% of the time. Designed effects show up
+ at a few chosen moments: opening UI ticks over a near-silent bed (ref_6), tonal zips into cuts (ref_5, ref_6), a noise
+ riser at the very end (ref_1), a sub drop under a cut and an end chord (ref_8). ref_4 (a cut-down) has no designed effects at
+ all; ref_3 and ref_7 bury theirs under voice or a -7 LUFS wall of music.
+- **ref_2 is the other model:** a film scored entirely with effects. No beat, 12 stop-downs (drops to silence
+ between ideas), LRA 12 LU, integrated -22 LUFS. Every effect is exposed, and every one is short, band-limited and
+ shaped (see below).
+- So "pro" is mostly **restraint and placement**: few sounds, each with one clear gesture (a pitch move, a gate, a
+ thump), cut on the picture, sitting about 13-17 dB over the music when there is music.
+
+## Per category
+
+Counts are measured events (exported trims in brackets: forge / bench). Ranges are min-max, "med" = median.
+
+### Whoosh / swell into a cut (`whoosh_big`), 5 (2 / 0)
+- **Made of:** in the SFX-only film a whoosh is a **low swell, not air**: energy almost all under 150 Hz (bed-subtracted
+ octave balance, re total: 31 Hz -19, 63 Hz -14, 125 Hz -14, 250 Hz -19, 1 kHz -28, 4 kHz -31, 16 kHz -37 dB),
+ centroid 51-150 Hz, tilt -3 to -13 dB/oct, a faint high air layer on top at -20..-30 dB. The two buried whooshes in
+ ref_1 are brighter (centroid 0.5-0.9 kHz) but the music makes that uncertain.
+- **Envelope:** 0.5-1.0 s, symmetric to slightly front-loaded: rise (-20 dB -> peak) 190 ms, fall to -20 dB 90 ms,
+ to -40 dB 240 ms; rise shape straight-to-concave in dB (it accelerates into the peak).
+- **Pitch:** the centroid falls about 2.3 octaves across the pass (8.28-9.30 in ref_2): a pass-by, not a static noise.
+- **Stereo:** mono or near-mono (side 30-40 dB under mid); no pan travel in any example. The width in these films
+ comes from textures, not from whooshes.
+- **Timing:** peak 127 ms *after* the cut (ref_2 8.64), or a swell that peaks 313 ms before the cut and dies into it
+ (ref_2 2.88); the buried one in ref_1 peaks 100 ms before its cut. So: peak within about +-150 ms of the cut, with
+ the energy straddling it.
+- **Level over music:** +15 to +21 dB (ref_1, two examples).
+
+### Riser (`riser`), 3 (1 / 1; one music riser measured only)
+- **Designed riser (ref_2, 0.84 s):** three layers you can see: (1) a **stutter gate**, 34 pulses at 22 ms median
+ spacing (45/s), speeding up from 24 ms to 20 ms toward the cut; (2) a **rising tonal layer**, about 2 kHz -> 8 kHz
+ (+2 oct; the last 0.22 s climbs 4.2 -> 8.1 kHz, about +4 oct/s); (3) a steady low drone (50-500 Hz) under it all.
+ It ends on the cut (+20 ms) and hands over to a low whoosh / boom that blooms just after.
+- **Noise riser (ref_1, 1.15 s, film end):** high band (> 4 kHz) climbs about 35 dB, centroid +1.4 oct
+ (360 Hz -> 1.1 kHz ridge), rise concave in dB (slow start, fast finish), side 14 dB under mid.
+- **Music riser (ref_7, measured only):** high band +20 dB over 0.45 s into the drop, only +5 dB over the music.
+- **Rise shape:** concave in all three: the level accelerates; most of the rise happens in the last third.
+- **Level over music:** +15 dB (ref_1).
+
+### Impact (`impact`), 3 (2 / 0)
+- **Made of:** sub-dominated: 31 Hz -15, 63 Hz -9, 125 Hz -12, 250 Hz -18, 500 Hz -36, 1 kHz -45 dB re total; under 150 Hz
+ holds all but 0.7 dB of the energy in ref_2 4.71; tilt -3.6 to -5.7 dB/oct; ridge at 82 Hz.
+- **Layers:** a broadband transient on top (full-band vertical line at the onset), the sub body, and **a textured tail**:
+ ref_2 4.71 has a granular low rumble (pulses every 28 ms, 36/s, slowing slightly) lasting 1.2 s; ref_2 14.02 has a
+ sustained high air band (5-10 kHz) over the body.
+- **Envelope:** attack 50-290 ms to the loudest point (they swell into the body rather than peak on the transient);
+ tail: t40 230 ms to 1.08 s, decay 38 dB/s for the rumble; **both designed impacts end with a hard gate** (the tail
+ is cut, not left to ring).
+- **Stereo:** the body is centred, the rumble / air tails are decorrelated (correlation -0.01 and 0.24, side about
+ level with mid, pan travel 28-30 dB).
+- **Timing:** the swell starts 110-200 ms *before* the cut; the loudest point lands 65 ms before to 82 ms after it.
+
+### Sub drop (`sub_drop`), 1 (0 / 1)
+- ref_8 85.58: a **sub tone 64 -> 44 Hz** (-0.55 oct over 0.75 s) entering on a cut with a bright transient on top;
+ energy share under 150 Hz -0.5 dB of total; rise to the sub peak 430 ms (it blooms after the cut: peak +380 ms),
+ decay 42 dB/s (straight in dB), t20 360 ms; narrow (side 13.5 dB under mid); +13 dB over the voice + music.
+
+### Logo / end sting (`logo_sting`), 2 (1 / 1)
+- **Designed (ref_2 28.62):** a **falling chirp 1.5 kHz -> 150 Hz in 85 ms** (-3.3 oct, about -38 oct/s) landing on a
+ **low tonal hum** (fundamental about 64-80 Hz with harmonics to 160 Hz, sinking -0.6 oct) that rings about 0.8 s;
+ mono (correlation 1.0); balance peaks at 250-500 Hz (-13 / -6 dB re total), tilt -6.9 dB/oct; t20 58 ms, t40 260 ms
+ with a concave tail. It starts 28 ms after the cut that ends the glitch.
+- **Music ending (ref_8):** a struck end chord with a 4 s ringing tail (centroid 1.9 kHz, decays about 130 dB/s at
+ first, then the tail).
+
+### Glitch / stutter (`glitch`), 1 (1 / 0)
+- ref_2 27.90-28.60: crackle first (sparse high grains, 4-12 kHz), then a dense broadband stutter: 11 bursts at 28 ms
+ median spacing (36/s), **speeding up from 32 ms to 22 ms** into the cut; bright (centroid 9.2 kHz, tilt +3.8
+ dB/oct, 8 kHz band strongest); **fully decorrelated** (correlation 0.04, side as loud as mid, pan travel 9 dB).
+ **It ends exactly on the cut (0 ms)** and the sting takes over.
+
+### Shimmer (`shimmer`), 2 (2 / 0)
+- **Granular sparkle (ref_2 6.15, 1.95 s):** dense short partial grains every 20 ms (50/s) between 1 and 10 kHz over one
+ steady tone at about 500 Hz; swells 0.5 s, fades about 0.8 s; balance 500 Hz -11, 1 kHz -15, 2 kHz -9, 4 kHz -15,
+ 8 kHz -20, 16 kHz -36 dB; tilt +6.5 dB/oct; **wide** (correlation 0.08, side 0.3 dB under mid, pan travel 14 dB).
+- **Melodic chime run (ref_2 24.25, 1.95 s):** glockenspiel-like notes (270 Hz - 10 kHz partials) panned note by note
+ (pan travel 94 dB = hard-panned notes), cut off by a gate at the end.
+
+### Notification ding (`notify`), 4 (4 / 0)
+- **A struck tone with one inharmonic partial:** fundamental about 1.8-2.2 kHz plus a partial near 3.4x (6.3 kHz),
+ attack 1-15 ms, t20 27-42 ms, t40 30-180 ms (short, convex: they ring briefly and stop), 0.23-0.36 s in all.
+- **Successive dings step up a semitone:** fundamentals 1822, 1934, 2045, 2168 Hz (ratios 1.061, 1.057, 1.060).
+- Balance: 1 kHz -6, 2 kHz -5 dB, nothing under 500 Hz (< -38 dB); stereo moderate (side 5.5-13 dB under mid).
+- +16 to +17 dB over the bed they ride on.
+
+### Pop (`pop`), 3 (2 / 1)
+- **Chirp pop (ref_2 13.10):** a sine **falling 9.8 kHz -> 350 Hz in 110 ms** (-4.8 oct, about -43 oct/s), preceded by a
+ 20 ms blip at 3 kHz; attack 32 ms (the loudest point is mid-sweep, around 1-6 kHz), t20 14 ms after it.
+- **Blip pop (ref_2 13.30):** a 1.2 kHz tone with harmonics, gated on and off (70 ms box, 2 ms attack, 7 ms release).
+- **Over music (ref_5 16.84):** a tonal blip falling 1.1 kHz -> 100 Hz with a click, +14 dB over the music.
+- All three are **mono** (correlation 1.0 or side 40 dB down).
+
+### Element pop-in (`pop_in`, not a forge category yet), 10 (10 / 0)
+- The most used effect in ref_2: one per element appearing, fired in a run (17 events over 3.3 s, spacing 120-310 ms,
+ median about 205 ms, settling into a steady 200 ms pulse).
+- **Made of:** a **thump body at 80-150 Hz** (ridge peak about 105 Hz; under 150 Hz holds all but 0.5 dB of the
+ energy; tilt -4 to -6 dB/oct) plus a **short noise tick** (1-10 kHz, about 30 ms, 30-40 dB under the body), often
+ as a quick double hit (two bodies 60-70 ms apart).
+- **Envelope:** 0.14-0.27 s, attack 6-19 ms (median 16), t20 16-35 ms (median 20), t40 30-80 ms; convex (holds, then
+ stops) in 7 of 10.
+- **Stereo:** moderately wide (side 3.5-9 dB under mid, correlation 0.38-0.78).
+- **Timing:** lands 25-40 ms after its cut (first and last of the run).
+
+### Tap (`tap`), 1 (1 / 0)
+- ref_2 18.70: a 150 Hz thump (ridge 130-160 Hz) with a faint broadband click, 0.1 s, attack 11 ms, t20 18 ms, t40 27 ms,
+ tilt -6.5 dB/oct, side 5 dB under mid; 86 ms before its cut.
+
+### Click (`click`), 5 (1 / 2; two measured only)
+- **Bright UI clicks (ref_2, ref_6, ref_8):** attack 0-3 ms, t20 6-16 ms; centroid 5-10 kHz, tilt +4 to +12 dB/oct; the
+ ref_2 click has tonal partials at 5-8 kHz (a "tink" rather than a noise snap).
+- **Mouse-like click over music (ref_5):** broadband with a low body (centroid 430 Hz, tilt -3.7 dB/oct), attack 10 ms,
+ t20 11 ms, t40 37 ms, +13 dB over the music.
+- Mostly mono (side 10-14 dB under mid). ref_6's opening click lands 31 ms before its cut.
+
+### Hover tick (`hover_tick`), 6 (3 / 3)
+- Tiny high ticks: 35-80 ms windows, attack 0-5 ms, t20 6-25 ms; centroid 2.8-9.5 kHz; tilt +2.4 to +6.2 dB/oct;
+ balance: 1 kHz -23, 2 kHz -18, 4 kHz -13, 8 kHz -8 dB re total, almost nothing under 500 Hz.
+- Two kinds: **tonal pings** (ref_2: a single partial at 6-15 kHz, about 10 ms) and **filtered noise ticks**
+ (ref_6: 2-12 kHz noise, 25-40 ms, the spectral peak falling as it decays).
+- Over a quiet bed: +15 to +20 dB.
+
+### Typing (`typing_key`, `typing_run`), 7 keys (6 / 1) + 1 run
+- **Designed typing is high-passed noise, nothing else:** each key a noise burst at 3-12 kHz (ridge 8.6-11 kHz),
+ **essentially nothing under 2 kHz** (bands up to 1 kHz at -60 dB, the floor; 2 kHz -28, 4 kHz -13, 8 kHz -7,
+ 16 kHz -14 dB re total), tilt +12 to +19 dB/oct; attack 2-5 ms, t20 11-18 ms, t40 about 60 ms; convex; mono.
+- **The run (ref_2 10.40-11.95):** keys at 62-148 ms spacing (median about 87 ms, about 11.5 keys/s), level and
+ timing jittered, a soft low swell rising under the end of the run.
+- The bench key (ref_8, in a voice-over gap) is a more realistic mid-range key (centroid 3.2 kHz).
+
+### Zip (`zip`, not a forge category yet), 4 (0 / 4)
+- **Fast tonal pitch sweeps** (a sine-like glide plus harmonics), 0.18-0.28 s, sitting only **+7 to +9 dB over the
+ music** (lower than the hits):
+ - up: about 100 Hz -> 1.5 kHz in 0.2 s (*read*, about +20 oct/s), starting 39 ms before a cut (ref_6 1.60);
+ - up: about 100-150 Hz -> 10 kHz in 0.22-0.25 s (*read*, about +30 oct/s), **ending on the cut** (+20 ms, ref_6 3.78);
+ - down: 7.2 kHz -> 420 Hz in about 60 ms (*read*, about -60 oct/s), across a cut (peak 65 ms before it, ref_5 22.80);
+ - arc: about 1 -> 3 -> 1 kHz over 0.25 s (*read*, ref_5 28.22).
+- Straight lines on a log-frequency axis: the sweeps are exponential (constant octaves per second).
+
+## What the pro sounds have in common
+
+1. **One gesture each, and it is mostly pitch or gate.** Zips at 20-60 oct/s, pop chirps at about -43 oct/s, the sting
+ chirp at -38 oct/s, dings stepping up a semitone, a riser's tonal layer climbing 2 octaves. Risers and glitches are
+ **gated at 20-45 ms, and the gate speeds up toward the cut** (24 -> 20 ms, 32 -> 22 ms).
+2. **Band-limited on purpose.** Typing has nothing under 2 kHz; pop-ins, taps, impacts and the designed whooshes live
+ under 150-250 Hz with only a thin tick or air layer on top (20-40 dB down); dings have nothing under 500 Hz. The UI
+ and transition sounds mostly leave 300 Hz-1 kHz (where the voice and the music's chords are) to the music; only the
+ sting, the zips and the chirps pass through it.
+3. **Hard ends.** Short UI sounds hold, then stop (convex decay in 7 of 10 pop-ins, 5 of 6 keys, 4 of 4 dings); both
+ designed impacts and the chime run end on a gate, not a natural ring-out. Long natural tails are the exception (the
+ music end chord).
+4. **Mono for objects, wide for textures.** Pops, keys, clicks, whooshes and the sting are mono to near-mono; shimmer and
+ glitch textures are decorrelated (correlation 0.04-0.36) and move (pan travel 9-94 dB); pop-ins and impact tails are in between.
+5. **Placed on the cut, sound a little early.** Attacks of impacts, sub drops, taps and clicks start 30-200 ms
+ before the cut, with the body or peak landing within about 80 ms of it (sub bloom up to +380 ms); whoosh peaks
+ within about +-150 ms; risers, the zip-up into a cut and the glitch **end** on the cut (0-20 ms) and hand over to
+ the next sound; pop-ins land 25-40 ms after their cut.
+6. **Levels.** Over music, hits, clicks, pops and dings mostly sit +13 to +17 dB over the quiet bed between beats
+ (K-weighted, loudest 100 ms; up to +21 dB for a whoosh), tonal zips +7 to +9 dB. In the SFX-only film, effects peak around -16 to -38 LUFS (loudest 100 ms)
+ with silence between ideas.
+
+## Targets for synthesis recipes
+
+Concrete numbers a recipe should hit to read as "pro designed" in this idiom (measured above; ranges = what the films
+do; judge with `eval/forge/pro/measure.py` on the render, alone, bed = silence).
+
+| category | length | attack | tail | balance | pitch / motion | stereo |
+|---|---|---|---|---|---|---|
+| whoosh_big (designed swell) | 0.5-1.0 s | -20 dB -> peak 150-250 ms, accelerating | -20 dB in 80-120 ms, -40 dB in about 250 ms | 80% + of energy < 150 Hz, tilt -3..-12 dB/oct, air layer 20-30 dB down | centroid falls about 2 oct across the pass | mono |
+| riser | 0.8-1.5 s (longer allowed) | concave: half the rise in the last third | ends on the hit / cut, hands over | drone + tonal layer + high noise | tonal layer +2 oct (2 -> 8 kHz); gate 24 -> 20 ms (40-50 pulses/s) accelerating; high band +30-35 dB over the build | mostly centre (side about 14-18 dB down) |
+| impact | 0.6-1.3 s | transient on top, body peaks 50-290 ms later | textured tail (grains every 25-35 ms) then a **hard gate**; t40 0.25-1.1 s | > 75% < 150 Hz, tilt -4..-6 dB/oct, ridge about 80 Hz | tail grains slow down slightly | centre body, decorrelated tail |
+| sub_drop | 0.8-1.5 s | 30-50 ms transient, sub blooms 0.3-0.4 s after | 40 dB/s straight-in-dB decay | > 85% < 150 Hz | 64 -> 44 Hz (-0.5 oct over 0.75 s) | narrow |
+| logo_sting (designed) | 0.8-1.5 s | 70 ms chirp | t40 about 260 ms, concave | peak 250-500 Hz, tilt about -7 dB/oct | chirp 1.5 kHz -> 150 Hz in 85 ms into a hum at 64-80 Hz sinking 0.6 oct | mono |
+| glitch | 0.4-0.8 s | crackle then stutter | ends on the cut | bright: centroid about 9 kHz, tilt about +4 | bursts every 32 -> 22 ms (accelerating) | fully decorrelated |
+| shimmer | 1.5-2.5 s | swell 0.5 s | fade 0.8 s or gate | 0.5-8 kHz, tilt +2..+6.5 | grains every 15-25 ms over one steady tone | wide (corr < 0.4), moving |
+| notify | 0.2-0.4 s | 1-15 ms | t20 25-45 ms, convex (stops) | fundamental 1.8-2.2 kHz + inharmonic partial near 3.4x; nothing < 500 Hz | a sequence steps up 1 semitone per ding | near mono |
+| pop (chirp) | 0.1-0.15 s | loudest mid-sweep | t20 about 15 ms after it | mid-high | sine falling about 5 oct in 110 ms (about -43 oct/s), optional 20 ms pre-blip | mono |
+| pop (blip) | 50-80 ms | 2 ms | 5-10 ms release (box) | 1-1.5 kHz tone + harmonics | none | mono |
+| pop_in | 0.14-0.25 s | 6-20 ms | t20 about 20 ms, t40 30-80 ms, convex | thump 80-150 Hz, > 85% < 150 Hz; tick 1-10 kHz 30-40 dB down | optional double hit 60-70 ms apart; runs every about 200 ms | slightly wide (corr 0.4-0.8) |
+| tap | about 0.1 s | about 10 ms | t20 about 18 ms, t40 about 27 ms | 130-160 Hz thump + faint click, tilt about -6.5 | none | near mono |
+| click (UI) | 30-60 ms | 0-3 ms | t20 6-16 ms | centroid 5-10 kHz, tilt +4..+12, tonal partials 5-8 kHz allowed | none | mono |
+| hover_tick | 20-40 ms | 0-5 ms | t20 6-25 ms | centroid 3-9.5 kHz, < 500 Hz empty | noise tick with a falling peak, or a single 6-15 kHz ping | mono |
+| typing_key (designed) | 50-80 ms | 2-5 ms | t20 11-18 ms, t40 about 60 ms, convex | noise 3-12 kHz only: < 2 kHz at least 30 dB down, tilt +12..+19 | none; a run jitters spacing 60-150 ms (about 11 keys/s) and level | mono |
+| zip | 0.15-0.3 s | 20-35 ms | ends on the cut | tonal glide + a few harmonics | exponential sweep 20-60 oct/s: up about 100 Hz -> 1.5-10 kHz, down about 7 kHz -> 400 Hz, or an arc | near mono |
+
+Placement targets (for anything that scores a film): attacks 30-200 ms before the cut with the peak within about 80 ms
+of it; whoosh peaks within +-150 ms; risers / zips-up / glitches end on the cut (0-20 ms) and hand straight over to the
+next sound; over music, accents at +13..+17 dB over the quiet bed and tonal sweeps at +7..+9 dB; leave silence or the
+music alone between ideas.
+
+## The reference sets this produced (local only)
+
+`out/refs_pro/registry.json` is in the `earshot.forge.refsets` format (`{'version', 'categories': {cat: {forge, bench,
+note}}}`, paths relative to the file), so `EARSHOT_REFSETS=out/refs_pro/registry.json` (or `refsets.load(path)`)
+reads it directly. The split is **by film**: ref_2, ref_3 and ref_7 are forge for every category; ref_1, ref_4, ref_5,
+ref_6 and ref_8 are bench (checked with `refsets.check_split`). In practice every forge trim comes from ref_2 (ref_3 and
+ref_7 gave nothing clean enough to export) and the bench trims come from ref_1, ref_5, ref_6 and ref_8. 51 trims (37 forge, 14 bench), trim + fade only, original
+gain, stereo 48 kHz 24-bit, with the music bed still underneath where there was one (each manifest entry carries its
+bed level, over-bed and SNR, the earshot timeline events inside the window and the nearby cuts, and every measurement).
+
+| category | forge | bench | note |
+|---|---|---|---|
+| click | 1 | 2 | |
+| hover_tick | 3 | 3 | |
+| typing_key | 6 | 1 | |
+| pop | 2 | 1 | |
+| riser | 1 | 1 | |
+| logo_sting | 1 | 1 | |
+| whoosh_big, impact, shimmer, notify, glitch, tap | 2, 2, 2, 4, 1, 1 | 0 | only the SFX-only film has them exposed |
+| sub_drop | 0 | 1 | |
+| pop_in, typing_run (new) | 10, 1 | 0 | |
+| zip (new) | 0 | 4 | |
+
+The benchmark can only use categories with bench trims (click, hover_tick, typing_key, pop, riser, logo_sting,
+sub_drop, zip); the rest are forge-side targets. `whoosh_fast`, `swish`, `swipe`, `toggle` and `downlifter` were not
+found exposed in any of the eight films.
+
+Rebuild: `python eval/forge/pro/run_timeline.py ref_1 ...` (earshot timeline + sheet), `viewer.py overview|crops`,
+`study.py` (measure, export, manifest, registry, stats, category sheets), `extra.py` (ridges, pulse rates),
+`film_table.py`. The curated event list with every time and note is `eval/forge/pro/events.py`.
diff --git a/docs/motion-sfx-techniques.md b/docs/motion-sfx-techniques.md
new file mode 100644
index 0000000..951d780
--- /dev/null
+++ b/docs/motion-sfx-techniques.md
@@ -0,0 +1,727 @@
+# Motion-design SFX: how the pros build them, as synthesis recipes
+
+For anyone writing an earshot forge recipe (`earshot/forge/recipes/*.py`) who wants sound effects that hold up in a
+motion-design launch video. Research notes, 2026-10-16, branch `forge-v2`.
+
+How to read the numbers:
+
+- **(src N)**: the number or claim comes from reference N at the bottom of this page.
+- **[sv]**: a *starting value*. This is synthesis practice, not something a cited source states. Tune it by listening
+ and measuring (earshot's tone, polish and envelope checks).
+- **(earshot)**: measured by earshot itself, either in `docs/launch-video-sound.md` (7 pro launch films) or in a
+ recipe's notes on its real reference recordings.
+
+The web sources are mostly practitioner tutorials and vendor guides. They agree on structure (layers, movement,
+processing). They give few hard numbers, and the numbers they do give vary. Where only a search summary was available
+and the page itself was not read, the reference says so.
+
+---
+
+## 0. The difference between a "real" sound and a motion-design sound
+
+The forge's v1 recipes are physical models fitted to raw recordings: a button click, a key press, a bubble pop, a
+swung stick, a drum boom. Launch-video SFX are a different product. They are **designed**, which means:
+
+1. **Several layers, each with one job.** Every source describes a pro SFX as 2-4 layers that peak together:
+ transient / body / sub / tail for hits (src 9, 10), and air / texture / tonal / landing for whooshes (src 2, 3, 4).
+ The usual fix for a flat hit is another layer, not another plugin (src 10). A single layer is the amateur
+ signature (src 1, 42).
+2. **Each layer owns a band.** Layers are EQ'd so they do not fight. Two body layers sharing ~200 Hz cancel each
+ other and turn to mud (src 10). Keep 3-4 elements at most (src 7).
+3. **Movement.** A whoosh or riser with a static spectrum sounds cheap. "Movement is the whole effect" (src 1). Filter,
+ pitch, level and pan move together, along curves that accelerate into the peak (src 7).
+4. **Processed and glued.** Light saturation for harmonics (so it survives small speakers), transient shaping, bus
+ compression that glues without squashing, one shared space, then a limiter (src 9, 10, 41).
+5. **Edited clean.** The file starts on the first sample of the transient with no leading silence (src 16) and has
+ no noise floor or room tone unless that is the point. The tail is trimmed but never chopped. Pops in a pro kit last
+ 0.19-0.41 s, with almost nothing below 150 Hz or above 4 kHz (earshot, `pop.py` notes).
+6. **Exaggerated, not literal.** Pitching a sound down makes it bigger and heavier; pitching it up makes it smaller and
+ lighter (src 42). Bigger whooshes are lower and slower (src 3, search summary). Designers pitch bright recordings
+ down 2-3 octaves to make sub-heavy material (src 9).
+7. **A palette.** UI sounds come from one patch, with only pitch and envelope changed (src 16). Earcon families share
+ timbre, register and rhythm (src 17). The tonal parts are tuned to the music's key (src 10).
+8. **Synced to the frame and used sparingly.** A sound a frame or two off breaks the illusion (src 42). Most motion
+ needs no sound, because the music carries it. The big accents are rare (src 18, src 4, earshot).
+
+So for the forge, a physical model is a good **source layer**. A motion-design SFX recipe needs a **design stage** on
+top of it: layers, per-layer EQ and saturation, glue, space and an edit. Its references should be designed library
+SFX, not raw foley recordings.
+
+### The universal design chain (per sound)
+
+| step | what | start values |
+|---|---|---|
+| 1 | Band each layer (HP / LP, one static EQ move) | sub < 120 Hz, body 80-800 Hz, transient > 1-2 kHz, air > 2 kHz [sv] |
+| 2 | Saturate body and transient lightly, never the clean sub | tanh/tape, drive 3-9 dB [sv]; distortion adds overtones, so EQ and compress after it (src 9) |
+| 3 | Shape transients | keep the crack, shorten its tail (src 10) |
+| 4 | Glue the sum | bus comp 2:1-4:1, attack 10-30 ms (lets the transient through), release 60-150 ms, 2-4 dB gain reduction [sv]; glue, not squash (src 10) |
+| 5 | Space | reverb on body and tail only, sub dry (src 10); pre-delay 10-30 ms keeps the attack clear [sv]; darken the return (LP 3-6 kHz) [sv] |
+| 6 | Stereo | transient and sub centred; width from reverb and decorrelated layers; delays of 2-50 ms fuse into one sound rather than an echo (src 36), but check the mono fold-down (src 4) |
+| 7 | Finish | HP at 20-25 Hz (energy below 25 Hz wastes headroom, src 10); look-ahead limiter at -1 dBFS true peak; loudness-match the family (src 16) |
+
+The round-1 `earshot/forge/fx.py` (in progress; names may change) already has most steps: `saturate`, `transient`,
+`reverb`, `limit`, `width` / `decorrelate` / `pan`, `doppler`, `sweep_filter`, `tape_stop`, `crush`, `stutter`,
+`glitch`, `granular` and `reverse_swell`. `earshot/forge/polish.py` detects the artifacts that make a sound cheap:
+clicks, aliasing, DC, rings, chopped tails, leading silence and loudness spread.
+
+### Variation (round robin)
+
+Repeated sounds need variants: a few, chosen at random (src 22, search summary). Typing must never repeat the same
+sample twice in a row (earshot). Per-render jitter: pitch +-0.3-1 semitone, level +-1-2 dB, timing and decay +-10 %,
+with fresh noise seeds [sv]. Timbre stays fixed per *family*, so a set sounds like one product.
+
+---
+
+## 1. Whoosh / swish / swipe
+
+**Anatomy** (src 1-5)
+
+| layer | job | notes |
+|---|---|---|
+| air body | the motion itself | filtered noise band that moves; pink is smoother than white (src 1) |
+| texture | material and distance | cloth, paper, brush (src 4); cymbal swells exaggerate the peak (src 2) |
+| tonal / style | identity, "digital" or "designed" feel | optional, and it gets repetitive if overused (src 4) |
+| low weight | size | sine or hum for big moves (src 2, 3) |
+| landing | the stop | a separate impact, click or pop, only when the object visibly stops (src 4) |
+
+All layers share one peak moment (src 2, 3). Doppler: the pitch rises on approach and falls after the pass (src 1).
+
+**Durations, matched to the move.** For quick UI swipes or fast cuts, 0.25-0.5 s (src 1). A small card crossing ~10 %
+of the screen takes about 180 ms (src 4). A title reveal is about 0.48 s (src 4). A general whoosh is ~0.8 s (src 1).
+A product fly-by is 1.15 s with its peak at 620 ms, i.e. 54 % (src 4). A heavy close pass is about 1.2 s (src 4), and
+big reveals run 1 s or more (src 1). Make separate short, medium and long variants rather than time-stretching one
+file, because stretching smears transients (src 4).
+
+**Envelope.** The sound starts quietly, builds quickly to its loudest point, then trails off (src 3). Mark three
+points: prepare (motion starts), cross (fastest frame or cut), release (src 4). Put the peak at 50-70 % of the length.
+The rise follows an accelerating curve (power 2-3, or exponential in dB); the fall is an exponential decay at about
+twice the rate of the rise [sv]. Loudness of a moving object goes roughly as speed³ (dipole radiation ~U⁶), which
+gives a crisp, short top (earshot `whoosh.py` notes). Shorter, steeper rises read as sudden; keep anticipation short
+when the visual should feel sudden (src 4).
+
+**Synthesis** [sv unless marked]
+
+- Source: pink noise (src 1). Use 2-3 band-pass bands at fixed ratios, e.g. 1 : 1.6 : 2.5, moving together. One band
+ is a noise wash.
+- Air whoosh: band-pass Q 1-3. The centre sweeps from 300-600 Hz up to 1.5-5 kHz at the peak, then falls back to
+ 400-800 Hz. The sweep follows the speed curve: centre ∝ speed^0.5-1.
+- Heavy whoosh: centre 150 Hz - 2 kHz, longer, plus a sine at 40-80 Hz swelling with the peak, about 12 dB under the
+ body. For a cymbal-like peak, reverse a short noise-burst reverb tail into the peak (src 2).
+- Swish (cane, whip, blade, thin fast object): 80-250 ms, brighter (2-10 kHz), steeper rise. Add a narrow aeolian
+ whistle at f = 0.2·U/d (Strouhal; e.g. 30 m/s past a 1 cm rod ≈ 600 Hz), as band-passed noise at Q 15-40.
+- UI swipe (digital): 100-250 ms. High-passed noise (HP 300-800 Hz) plus an optional tiny tonal chirp (a sine gliding
+ up an octave across the swipe, ~10 dB under the noise). No low end.
+- Doppler: the frequency ratio across a pass is (c+v)/(c−v). At 20 m/s that is ≈ 2 semitones in total; at 50 m/s,
+ ≈ 5 semitones (c = 343 m/s, src 39). Apply it to the tonal layer and the filter centre. Designed whooshes often
+ exaggerate it to 3-12 semitones on the tonal layer.
+- Pan: equal-power L→R following tanh((t−t_peak)/w), with narrow-wide-narrow width across the pass (src 4). Keep the
+ mono sum intact.
+- Tail: a short reverb for size (src 1), or a pitched delay for a sci-fi feel (src 1). If an impact follows, leave
+ ~80 ms of silence before it (src 4).
+
+**Processing.** Carve each layer's band, compress lightly to tie the layers together (src 2), give the tail a short
+room or plate, and add a little distortion only for aggressive whooshes (src 1).
+
+**In the mix.** The loudest point lands on the cut or the fastest frame (src 1, 4). It starts 0.2-0.6 s before
+(earshot). It sits under the picture; it does not shout (src 1). Reserve the longest, widest whoosh for the biggest
+move (src 4).
+
+**Cheap-sounding mistakes.** Static noise with a volume fade and no filter or pitch movement. Harsh unfiltered white
+noise. Too slow (it drags) or too fast (it reads as a click). Mono with no movement. One layer (src 1). The same
+envelope on every edit. A tail running into the next event. A stereo sweep on every sideways move. Making it louder to
+make it "better". A whoosh on a scene change where nothing actually moves (src 4).
+
+---
+
+## 2. Riser (uplifter, build)
+
+**Anatomy.** A noise riser (the filter opens), a tonal riser (the pitch rises), an optional texture or granular layer,
+a rhythmic element (accelerating LFO, tremolo or roll), and a growing reverb (src 6, 9). Use 3-4 elements at most
+(src 7). **Let one motion lead**: filter for noise sources, pitch for tonal ones; the others support it (src 7).
+
+**Synthesis**
+
+- Noise: low-pass or band-pass at 24 dB/oct, cutoff 150 Hz → 10 kHz over the length, resonance 15-20 % (src 6;
+ Q ≈ 1.5-3 [sv]). The noise layer peaks slightly earlier than the tonal layer (src 6).
+- Tonal: saw or triangle, 5-7 unison voices detuned 10-15 cents (src 6). Pitch rises +12 to +24 semitones, narrowing
+ to 12 near the peak (src 6). Stack layers at 0 / +12 / −12 st that fade in at different times (src 6). Detune can
+ widen as it rises (src 8).
+- Accelerating modulation: LFO rate 1/2 note → 1/16 note (at 120 BPM, 1 Hz → 8 Hz), depth 10 % → 70 % (src 6). LFO
+ speed and intensity rise together (src 9).
+- A frequency shifter from 0 to +200 Hz (src 6) gives an inharmonic, sci-fi lift.
+- **Curves are exponential, not linear**: most of the change lands in the last beat or two (src 7). For example
+ p(x) = p0 + (p1 − p0)·x³, with x = t/T, or exponential in log-frequency [sv].
+- Level: −20 dB → 0 dB across the riser (src 6), on the same accelerating curve.
+- Endless rise (Shepard-Risset): octave-spaced sine (or saw) partials under a raised-cosine loudness envelope over
+ log-frequency, all gliding up together (src 35). Each layer must cover a full octave, or the reset is audible
+ (src 6). Fade the top and bottom layers (src 7).
+- "Convergence" reveal riser (THX Deep Note): 30 voices start at random pitches between 200 and 400 Hz and glide to a
+ chord spanning three octaves (src 34). That is a riser that resolves into the logo chord.
+- Width grows into the peak (src 7). Reverb grows too: size 30 % → 70 %; 2-3 s decay at 20-30 % wet for short risers,
+ up to 6 s at 40 % for long ones (src 6).
+- Reverse swell: reverse a reverb tail so it rises into the hit (src 40). `fx.reverse_swell` does this.
+
+**Length.** In a launch film, 1-4 s (earshot). In music, 4 bars for short transitions and 8-16 bars before a drop
+(src 6).
+
+**Ending.** The peak lands exactly on the downbeat or the reveal frame; a climax that arrives late steps on the new
+section (src 7). Then cut it abruptly, duck it 3-6 dB just before the drop (src 6), or leave silence for 0.1-0.5 s
+(earshot) or one beat (src 7), then the impact. A riser ends in a hit or a short silence (src 9).
+
+**Cheap-sounding mistakes.** Energy piling up below 100 Hz (high-pass it, ~150 Hz). A climax that lands after the
+downbeat. No release, so it feels relentless. Too many layers. The same riser on every transition (src 7). Too much
+white noise or saturation (src 6). Linear curves (src 7).
+
+---
+
+## 3. Downlifter (downsweep, fall)
+
+The mirror of a riser, placed on beat one of the new section or right after an impact. It is a push-and-release
+after the build (src 7). Length 0.5-4 s [sv].
+
+**Synthesis**
+
+- Noise: the filter starts fully open and closes, low-pass from 8-12 kHz down to 200-400 Hz (src 49, forum answer via
+ search summary; values [sv]). Band-pass with extra bandwidth and resonance also works (src 8).
+- Tonal: pitch falls 12-24 st [sv]. For the pitch-down impact, a sine-square wave with an envelope on pitch *and* on
+ the low-pass cutoff keeps the harmonics audible as the fundamental drops below hearing (src 8).
+- **Decelerating curves**: fast at first, slowing at the end, i.e. exponential decay with a time constant ≈ length/3
+ [sv].
+- Level decays while the reverb gets wetter: the dry part dies first [sv]. An LFO whose rate is shaped by a reversed
+ envelope, plus phase modulation and flanger, gives the classic synth downlifter (src 50).
+- Tape-stop variant: playback rate glides to 0 over 0.3-1 s (`fx.tape_stop`) [sv]. How steep the fall is sets whether
+ it feels like a lazy sag or a hard yank (src 51, search summary).
+
+**Mistakes.** The same as risers, plus a downlifter that masks the drop it follows: keep it 6-10 dB under the impact
+[sv].
+
+---
+
+## 4. Impact / hit (and braam)
+
+**Anatomy** (src 9, 10, 11)
+
+| layer | job | sources and numbers |
+|---|---|---|
+| transient | the timing, the "crack" the ear locks onto | short bright burst, mostly above 1 kHz: snare, clap, stick or a noise burst; shorten its tail (src 10) |
+| body | weight and character | kick, tom, taiko, metal resonance, gong (src 9, 10) |
+| sub | punch you feel | sine at 30-60 Hz with a pitch drop over 200-400 ms (src 10) |
+| tail | size and space | long dark reverb on the body; sub stays dry (src 10); the tail is typically a long reverb that fades (src 9) |
+| sheen / atmos | top and air | processed cymbal, metal, an atmospheric sound (src 9) |
+
+An example stack: distorted kick + high percussive element + processed cymbal + sub + atmosphere (src 9). Before the
+impact: pull back to near silence, because dynamic contrast makes the slam (src 11). Or use a reverse swell into it
+(src 40).
+
+**Synthesis** [sv unless marked]
+
+- Transient: a noise burst of 2-10 ms with an envelope raised to the 2nd-4th power (Farnell's bell striker: 10 ms of
+ noise, env⁴, src 15/06), high-passed or band-passed above 1-2 kHz, plus a 1-3 ms click. 0 to −6 dB against the body
+ peak.
+- Body (drum-like): a sine or triangle starting at 100-180 Hz and falling to 45-70 Hz with a pitch time constant of
+ 30-80 ms. Add inharmonic membrane overtones at ×1.59, 2.14, 2.30 that die faster than the fundamental (earshot
+ `impact.py` notes). Metal body: a cloud of inharmonic modes from 300 Hz to 4 kHz with decays falling as frequency
+ rises.
+- Sub: a sine starting 12-24 st above its end note and falling exponentially over 200-400 ms (src 10). Its final note
+ is tuned to the track's key (src 10). For trailer and logo hits, let it ring for 800 ms or more; game and UI hits
+ get a few hundred ms (src 10).
+- Big explosive boom (Farnell): a "fireball" of noise band-passed at 70 Hz then low-passed at 70 Hz twice, attack
+ 100 ms, decay 8 s. A "blast" of high-passed noise through a resonant low-pass near 7 kHz, swept in 30 ms, driven ×50
+ into a hard clip (src 15/31).
+- Size trick: render a bright layer (noise, metal) and play it back 2-3 octaves down (¼-⅛ speed) for sub-heavy
+ material. This beats pitching down an already sub-heavy sound (src 9).
+- Tail: a 2-6 s reverb with frequency-dependent decay (lows ring longest), darkened (LP 3-5 kHz), pre-delay 10-30 ms.
+ A flanged tail (a comb whose delay drifts) gives the descending partial fan heard in trailer hits (earshot
+ `impact.py`).
+
+**Processing.** Distortion on body and transient, then EQ and compression (src 9, 10). Bus compression or a little
+OTT for trailer and electronic styles, but over-compression flattens the transient (src 10). High-pass below about
+25 Hz (src 10). Pan the layers (src 9), but keep transient and sub centred [sv]. Limit the finished sum (src 9).
+
+**Braam.** A long, loud, low brass note at C1-C2 (≈ 33-65 Hz), with layers an octave apart (C0, C2 under C1). Vary
+the intonation or playing technique per layer. Automate distortion on one or more layers, bend the pitch down
+gradually, and put the group through a reverb (src 9). For synthesis [sv]: 3-6 detuned saws per octave layer through
+a low-pass whose cutoff opens from 200 Hz to 1.5-3 kHz over 50-150 ms (brass "blat"), then settles to ~800 Hz.
+Waveshaper drive rising over the note, a −1 to −3 st bend over 2-4 s, and a sine sub under it.
+
+**In the mix.** On the frame. Rare: the riser → stop-down → impact move happens once or twice per film (earshot). The
+biggest sounds are saved for the biggest moments (src 42).
+
+**Cheap-sounding mistakes.** Two body layers fighting around 200 Hz. An untuned sub clashing with the bass. An
+over-compressed bus that kills the transient. Sub-25 Hz energy that eats headroom. Trying to fix a flat hit with
+another plugin instead of another layer (src 10). Reverb on the sub (mud) [sv]. Generic stock stingers (src 11).
+
+---
+
+## 5. Sub drop (and 808 boom)
+
+**Anatomy.** A sine gliding down into the sub-bass region. It is usually a pure sine because it has no harmonics.
+Designers add subtle distortion or harmonics so it survives phones and laptops. The glide lasts from a fraction of a
+second to a few seconds: a quick punchy drop reinforces an impact, a long descent signals dread. It usually sits under
+an impact or downbeat as its low foundation, with the surrounding elements high-passed to make room (src 12).
+
+**Synthesis** [sv unless marked]
+
+- Pitch: start 1-2 octaves above the end note; end at 30-45 Hz, tuned to the key. Glide exponentially in frequency
+ (constant semitones per second, or faster at first) over 0.4-3 s.
+- Amplitude: a 2-5 ms attack ramp, starting at a zero crossing so it does not click. Hold ~30 % of the length, then an
+ exponential decay. End on a fade, never a cut.
+- Small speakers: phones cannot reproduce much below ~300 Hz, yet the ear infers the missing fundamental from its
+ harmonics (src 37). So add a parallel saturated copy (tanh, drive 6-12 dB) low-passed at 200-400 Hz under the
+ clean sine (a clean sub plus a distorted duplicate, src 48), or synthesise the 2nd and 3rd harmonics directly at
+ −12 to −20 dB.
+- 808 tutorials put the base sine at ~40-60 Hz, the pitch starting 1-2 st high and falling within 10-30 ms for a
+ click-like attack (a bigger, longer pitch fall gives a more obvious sweep), and the amplitude at ~5 ms attack,
+ ~700 ms decay, no sustain, 400-500 ms release (src 14, search summary).
+- 808-style boom: a sine at 32' (around C1-C2), fastest attack, decay fully open, sustain down. The pitch envelope
+ decides kick vs boom: shorter decay gives a kick, longer gives a boom. Then saturation (harmonics), mono,
+ compression and a low shelf cut. Avoid a sub-oscillator, because its extra harmonics muddy the sub (src 13).
+- Mono, always. One sub at a time in the whole mix (earshot).
+
+**Mistakes.** A pure sine that vanishes on phones (src 12, 37). Clicks at the start or end. Energy below 25 Hz
+(src 10). Reverb on the sub. A sub that is not in key (src 10).
+
+---
+
+## 6. UI click / tap / toggle / hover
+
+**Durations.** Taps and clicks last 30-150 ms; most interface cues are under 300 ms; notifications go up to ~500 ms
+(src 16). A reference table puts clicks at 10-80 ms (src 46c, search summary). Game UI guidance: a click under ~100 ms,
+a confirm 100-250 ms (src 22, search summary). Trim cues shorter than feels natural in isolation, because they play
+often (src 16).
+
+**Semantics** (shared expectations; inverting them feels wrong)
+
+- Neutral (tap, toggle, selection): a single tone with no pitch movement (src 16).
+- Positive (confirm, success, forward): rising pitch, a major third or perfect fifth up (src 16). Upward means yes or
+ forward (src 22, search summary).
+- Negative (error, cancel, back): lower, falling, slightly detuned or mildly dissonant (src 16). A flat, dull tone
+ means "denied" (src 22, search summary).
+- Toggle on vs off: on rises or sits higher, off falls or sits lower [sv, follows the rules above]. A physical toggle
+ is two contacts 30-150 ms apart (src 15/19).
+- Hover: near silence or nothing (src 22, search summary). If used: ≤ 30-50 ms, 12-20 dB under the click, nothing
+ above ~4 kHz [sv].
+- Frequent cues are higher, brighter and quieter; rare cues are lower and fuller (src 16, 18). Most interactions
+ should make no sound at all. Silence is the negative space that lets important sounds stand out (src 18).
+
+**Synthesis recipes**
+
+1. *Mechanical / plastic click* (Farnell, src 15/19): white noise → band-pass 5 kHz, Q 12. Envelope: a 1 ms ramp up,
+ then a 20 ms ramp down starting at 2 ms, **squared** before it multiplies the noise. A reusable click abstraction
+ takes (attack ms, decay ms, centre Hz) with Q 8.
+ - Push-button composite: clicks at 0 ms (1/20 ms, 4 kHz), 30 ms (1/50 ms, 3 kHz), 140 ms (4 kHz) and 150 ms
+ (7 kHz). All are summed into a 50 ms delay line whose output goes through ×0.1 gain and a band-pass at 700 Hz
+ Q 3, fed back for a small resonant body.
+ - Slide switch: pink-noise "clunks" at 0 and 200 ms, plus a short ping of two sines at 10.5 and 9.45 kHz with a
+ 50 ms decay.
+2. *FM tick* (SuperCollider example, src 23): carrier 1-10 kHz, modulator 100-1000 Hz, index 10-1000, attack 1-10 ms,
+ release 1-10 ms, high-pass at 1 kHz. A fast percussive envelope on both pitch and filter or amp gives bells, pops,
+ clicks, boinks and bleeps (src 24b, forum via search summary).
+3. *Tonal blip* (the "digital" UI style): a sine or triangle for a smooth, clean tone (src 16) at 600 Hz-2 kHz. Attack
+ 0.5-2 ms, exponential decay 20-60 ms; optionally a 1-3 st pitch drop over 10-20 ms for a "plip". Layer a short
+ tactile texture under it (src 16): a 1-3 ms noise click high-passed at 3 kHz, 6-10 dB down [sv].
+4. *Physical button* (earshot `click.py`): one dominant, very damped shell mode at 2-7 kHz (gone in 0.2-2 ms) over
+ weaker modes. Few mid housing modes, gone in a few ms; a long-ringing ~1 kHz housing reads as a wood block. The
+ release comes 25-35 ms later at −25 to −30 dB, or not at all.
+
+**Processing** (src 16). High-pass ~120 Hz. Tame harsh peaks at 2-5 kHz. At most a tiny, short room or plate. Limit
+and normalise so every cue sits at one *perceived* loudness. Mono by default. Trim to the first transient; leading
+silence makes the interface feel laggy.
+
+**Palette.** Build the family from one patch and change only pitch and envelope, with a shared reverb and character
+(src 16). Or make a confirm sound you like and derive the rest by pitching, shortening and filtering it (src 22,
+search summary). Earcons: start from timbre, register and rhythm; musical timbres with several harmonics beat pure
+tones (src 17). Rounder, softer, "less digital" sounds alert without stressing (Windows 11's redesign, src 21).
+
+**In the mix.** One click per on-screen click, on the frame the cursor presses. Short, bright (2-6 kHz) and ~10-15 dB
+under the music peaks, panned toward where it happens on screen (earshot).
+
+**Cheap-sounding mistakes.** Too long. Too much low end, which turns to mud on phones and laptops. Inconsistent
+loudness across the family. Auditioning only on good monitors. Leading silence (src 16). Melodic tails or personality
+on cues heard hundreds of times (src 46, search summary). Hover sounds on everything.
+
+---
+
+## 7. Pop / bubble
+
+**Physics.** A gas pocket rings at the Minnaert frequency, f ≈ 3.26 / r (Hz, r in metres): 0.5-3.5 kHz for
+millimetre bubbles. Damping gives Q ≈ 5-40. The pitch rises as the pocket shrinks and its neck opens: +10-120 % within
+3-80 ms. A film rupture tick comes first, with breathy noise that follows the pitch and a small low "puff" (earshot
+`pop.py`, src 45).
+
+**Farnell's bubble** (src 15/12): a cosine oscillator whose frequency follows an exponentially shaped ramp (`expcurve~
+100`, ~100 ms; a variant uses 200 ms) times a base frequency (e.g. 600 Hz; 240-270 Hz in the bubble-stream example).
+The amplitude envelope is `adenv~ 10 80` (≈ 10 ms attack, 80 ms decay), started 3 ms after the trigger. Then ×0.1 and
+a 40 Hz high-pass. Streams come from a 15 ms clock, prime-numbered steps and a 50 % probability gate.
+
+**The motion-design "pop-in"** (an element appearing: an icon, a bubble, a chat message) [sv]
+
+- A tonal blip with an upward sweep: a sine from 300-500 Hz up to 800-1500 Hz in 15-40 ms. Attack 0.5-1 ms (not 0:
+ a perfect step onset reads as a digital tick, earshot `pop.py`). Exponential decay 40-120 ms.
+- A 1-2 ms band-passed noise tick (2-4 kHz) on the onset, 6-12 dB down.
+- An optional second, smaller, higher ring 5-15 ms later (a daughter bubble, earshot `pop.py`) for a wetter, cuter pop.
+- For several items popping in, step the base pitch up a scale tuned to the music's key (pentatonic or major).
+- Edit like the kit: 0.2-0.4 s total, 40 dB down 35-145 ms after the peak, little below 150 Hz or above 4 kHz
+ (earshot).
+
+**Mistakes.** Long tails, a full-band tick and hiss, a big low puff, the same pitch for every element.
+
+---
+
+## 8. Notification / ding / success chime
+
+**Rules**
+
+- Success: two quick rising notes, a major third or fifth up (src 16). A notification is a short 2-3 note motif, up to
+ ~500 ms (src 16).
+- Error: lower, falling, slightly detuned (src 16). Success and error must be distinguishable without looking (src 16).
+- Hierarchy (Material Design): brand sounds first, then hero sounds (rare celebrations), then alerts and
+ notifications, then primary and secondary UX sounds. Notifications fire more often than hero sounds, so they are
+ shorter and built to survive repetition (src 20, search summary).
+- Earcon guidelines (src 17): pitch no higher than 5 kHz and no lower than 125-150 Hz. Notes no shorter than 0.0825 s,
+ though 1-2-note earcons can use notes as short as 0.03 s. Up to 6 notes per second. A 0.1 s gap between serial
+ earcons. Loudness 10-20 dB above the background. Register differences of 2-3 octaves if they must be told apart
+ absolutely.
+- Brand sound (Google "Super G"): two piano notes an octave apart, played slightly apart (flammed) for playfulness,
+ done in under 1.5 s. Its key (G) anchors the whole palette (src 18).
+- Calmer, rounder, softer alerts still notify without being overwhelming (src 21).
+
+**Synthesis**
+
+1. *FM bell / chime*: a non-integer carrier-to-modulator ratio gives inharmonic, metallic partials. Violet suggests
+ trying 1.41 (src 25, search summary); Chowning's classic bell is about 1:1.4 [not verified from a fetched source].
+ The index envelope decays fast, so the attack is bright and quickly mellows, like a real bell (src 24, 25). The
+ amplitude decays as a long exponential (src 24). Start values [sv]: carrier = the note (e.g. C6 1047 Hz, E6, G6).
+ Ratio 1.4 (bell), 3.5 (glassy) or 1 / 2 with ~0.2 % detune (e-piano or soft chime). Index from 3-8 down to ~0.5
+ with τ = 30-80 ms; amplitude τ = 150-600 ms. A slightly mistuned integer ratio gives an electric piano (src 24).
+2. *Modal bell* (Farnell's telephone bell, src 15/06). Partial ratios to the fundamental, by group, with relative
+ strengths and decay multipliers (decay = 2000 ms × multiplier):
+
+ | group | ratios | strengths | decay × |
+ |---|---|---|---|
+ | primary | 2.002, 3, 9.6 | .008, .02, .004 | 0.9 |
+ | secondary | 2.49, 2.571, 11 | .02, .04, .02 | 0.25 |
+ | sub / fundamental | 0.501, 1, 0.7 | .002, .001, (.02) | 1.2 |
+ | circular modes | 3.05, 6.242, 12.49 | .005, .05, .05 | 0.14 |
+ | striker group | 13, 16, 24 | .02, .03, .04 | 0.07 |
+
+ Striker: noise with a 10 ms decay, env⁴. Two slightly detuned gongs (650 and 653 Hz) are struck alternately every
+ 60 ms (the phone's ring); for a single ding, use one. The casing is two short
+ feedback delays (0.77 / 0.88 ms, gain 0.7) and band-passes at 287, 431 and 1243 Hz, Q 12. Higher partials die
+ faster; that is what makes it read as struck metal.
+3. *Glass / marimba "ding"* [sv]: a free bar's modes sit at 1 : 2.756 : 5.404 : 8.933 (free-free beam), with each
+ partial's decay falling roughly as f^-0.9 (earshot `pluck.py` notes the same law for tines). Add a soft 2-5 ms
+ mallet (low-passed noise pulse).
+
+**Processing.** High-pass ~120 Hz, a tiny plate or room, a little width, limit (src 16). Tune the notes to the
+music's key.
+
+**Mistakes.** Alarm-like beeps (earshot); for contrast, Farnell's alarms are plain sines at 600-1012 Hz switched
+roughly 2-4 times a second (src 15/04). Square waves. Tails over ~0.6 s on a frequent cue. Success and error too
+similar. Pitches outside 125 Hz-5 kHz (src 17).
+
+---
+
+## 9. Shimmer / sparkle
+
+This is decoration: use it only where something magical happens (an AI generation reveal, a "new" badge), short and
+low in level. Pro categories: a wide, glassy wash of highs; small bell-like notes scattered at random ("twinkle");
+fine granular sparkle that drifts rather than strikes; a single bright glitter burst with a fast tail (src 47, vendor
+categories via search summary).
+
+**Synthesis** [sv unless marked]
+
+- Ping cloud: 15-60 short pings per second, as sine or FM-bell grains. Pitches come from a pentatonic or major scale in
+ the music's key, between 2 and 8 kHz (C7 2093 Hz to C9 8372 Hz). Each ping: 0.5-1 ms attack, 30-200 ms exponential
+ decay, random pan, level +-6 dB at random. Density follows an envelope that swells with the motion and thins out at
+ the end. Random pitches that are not on a scale clash with the music.
+- Wash: noise high-passed at 6-8 kHz through a slowly modulated comb or flanger, ~18 dB under the pings.
+- Shimmer reverb: the reverb's wet signal is pitch-shifted an octave up and fed back into the reverb input, so each
+ pass climbs again. The shifted signal is not mixed straight to the output; the send level sets the strength. Add a
+ low-pass in the loop, because shifting up adds highs (src 27, forum via search summary). Some designs add filtered
+ delay with heavy feedback (src 27).
+- Farnell's "transporter" (src 15/33) is a sci-fi shimmer. Twelve band-passes (Q 1) at 620-1200 Hz with swept centres
+ on a buzzy source. Noise through band-passes at 775, 1550 and 2325 Hz (Q 13), shaped by a 10 ms rise and 5 s fall.
+ Three modulated taps on a 120 ms delay line with 0.7 feedback, then reverb.
+
+**Processing.** High-pass at 1-2 kHz, a de-esser at 6-10 kHz, a long airy reverb, width.
+
+**Mistakes.** Fatiguing 8-12 kHz energy. Off-key pitches. Constant density with no envelope. Too long or too loud.
+
+---
+
+## 10. Glitch / stutter / digital
+
+**Techniques with numbers**
+
+- Bitcrush (src 28): 8-12 bits for mild grit, 4-6 bits heavy (sweet spot 6-10), 1-bit at the extreme. Sample-rate
+ reduction to ~8 kHz for warmth or ~2 kHz for harsh aliasing. Crush after an EQ that isolates 500 Hz-2 kHz, so the
+ low end stays intact. A heavily crushed copy 20-30 % under the clean signal (src 28). Low-pass or a gentle high shelf
+ after crushing (src 29).
+- Buffer repeats (src 28): slices of 5-50 ms (start at 10-30 ms), repeated 4-8 times. Tighten the spacing for ramps or
+ keep it even for stutters; tempo-wise 1/32 to 1/64 notes. Step the repeat rate from 1/16 toward 1/64 for an
+ accelerating fill (src 29).
+- Granular (src 28): grains of 1-100 ms. 5-20 ms gives distinct artifacts; start at 20-30 ms. Smaller grains sound more
+ digital and stuttery, larger ones smoother.
+- Time-stretch artifacts: 400-800 % stretches, using the first 100-200 ms of the warped audio (src 28). Reverse slices,
+ random pitch jumps, odd-length cuts (src 30).
+- Sources (src 29): sharp transients with clear pitch survive chopping; pads and noise smear into atmospheres.
+- Keep a steady sub or bass under the glitch so the low end does not thin out (src 29).
+- Computed digital sources: R2D2-style chirps are random-stepped tones with random glides. Farnell's version: event
+ periods of 100-700 ms, a random 0-0.999 step value, FM with ratio 0-32 and index 0-2 (src 15/34). Data chirps [sv]:
+ square or pulse bursts at 1-4 kHz, 5-30 ms long, a new pitch per burst. Electrical buzz [sv]: mains harmonics,
+ gated.
+
+**For motion design** [sv]: glitch hits are short (100-400 ms) and lock to the visual glitch. One buffer slice per
+glitched video frame (33 ms at 30 fps, 42 ms at 24 fps) makes picture and sound stutter together. `fx.glitch` /
+`fx.stutter` / `fx.crush` / `fx.granular` already implement the operations.
+
+**Mistakes.** Overuse. Chops drifting off the grid. Stacked harshness from crushing plus aliasing. A thin low end.
+Judging the glitch only in solo (src 29).
+
+---
+
+## 11. Typing
+
+**Anatomy of a keystroke.** The press peak spans ~10 ms: a "touch" peak (finger on key) and a "hit" peak (key on the
+plate) at its two ends. The release peak comes ~100 ms later and is much weaker; laptop keyboards may lack it (src 31,
+via search summary of Zhuang et al. and Asonov & Agrawal). earshot's measured mechanical keys (`keypress.py`): a
+broadband bottom-out click; keycap and plate modes near 1.25-1.6 kHz plus a cluster up to ~2.3x; a case body at
+110-260 Hz; a 58-77 Hz "thock" that peaks 20-35 ms after the hit; a release 70-125 ms later (two small ticks, then the
+top-out); and an 8-10 kHz spring ping.
+
+**Timing.** One key sound per typed character, never the same sample twice in a row, slightly irregular timing
+(earshot). Human typing at 40-80 wpm is ≈ 3-7 characters per second (≈ 150-300 ms apart). On-screen "typed" prompts in
+launch films often run faster (10-20 chars/s, 50-100 ms apart), so releases overlap the next press [sv]. Jitter
+intervals by +-15-25 %; put a slightly longer gap before spaces and after punctuation [sv].
+
+**Synthesis** [sv]
+
+- A fixed modal set per key (the same key sounds the same twice) plus per-press variation: force +-2 dB, timing
+ +-10-20 ms, mode frequencies +-1-2 %. `keypress.py` already does this with its `key` parameter.
+- The space bar and Enter are larger keys: lower cap modes (×0.6-0.8), a stabiliser rattle (2-4 small ticks within
+ 5-15 ms), a louder release.
+- Laptop and scissor keys (the usual UI-demo sound): softer, shorter, no thock, brighter (2-6 kHz), a quieter release,
+ high-passed at 120-200 Hz. Mechanical "thock" is a deliberate style choice, not the default.
+- Stereo: a slight pan by key position (left-hand keys left), within +-20 %.
+
+**Mistakes.** A machine gun (identical samples or perfectly even timing). A big low thock under a light UI demo.
+Characters and sounds out of sync.
+
+---
+
+## 12. Logo sting / reveal
+
+**Anatomy.** A build (riser or reverse swell, 0.5-2 s) → a stop-down (0.1-0.5 s of near silence) → a hit (an impact
+with a sub) on the logo frame → a tonal tail or "bloom" (2-4 s) that resolves the music (earshot). Real examples:
+
+- Netflix "ta-dum": Lon Bender's wedding ring knocking on a cabinet, mixed with a hammer on an anvil and other
+ sweeteners, then a synth-like "blossom" from an effects-laden guitar placed directly after the knock. The brief was
+ tension, release and quirkiness; 20-30 versions were tried (src 32).
+- Google "Super G": two piano notes an octave apart, flammed, in under 1.5 s (src 18).
+- THX Deep Note: voices converging from random pitches to a wide chord (src 34).
+- Sonic logos are usually 2-5 s, with 3 s the most common figure. Lenovo specifies a 3 s end-bumper version (src 33,
+ vendor sources via search summary).
+
+**Synthesis** [sv]
+
+- Hit: the impact recipe with the sub shortened to 0.8-1.5 s.
+- Tonal bloom: a chord (root, fifth, octave, optionally a major third or ninth) in the music's key, built from FM or
+ modal bells plus a pad. It enters 0-30 ms after the hit with a 50-200 ms attack and a low-pass opening from ~1 kHz to
+ 6-8 kHz. Shimmer reverb on the bloom only.
+- Optional: a reverse swell (the hit's own reverb, reversed) for 0.3-1 s into the hit (`fx.reverse_swell`), or a
+ convergence riser ending on the bloom chord.
+
+**Timing.** The hit lands on the logo's landing frame. Finish within ~0.5 s of the last frame. The strongest hit of
+the last 4 s rings out 2.0-3.6 s in 5 of 7 pro films (earshot).
+
+**Mistakes.** A long fade-out or dead air at the end (earshot). A riser that is too long. A tonal tail out of key.
+Everything at once with no stop-down. A sub tail that outlasts the picture.
+
+---
+
+## 13. Levels and mixing in launch videos
+
+Measured on 7 pro launch films (earshot, `docs/launch-video-sound.md`) unless marked:
+
+- Music leads; SFX are accents. There are 1.2-1.7 salient hits per second in total (music included). There is **no**
+ measurable hit on every cut. Designed accents go to the reveal, the logo, the key UI action and section changes.
+- Master at about −14 LUFS integrated, true peak ≤ −1 dBTP.
+- Stop-downs: 4 of 7 films drop ≥ 10 dB for 0.15-1.5 s and come back on a hit.
+- UI foley sits ~10-15 dB below the music peaks, at 2-6 kHz, panned to its place on screen [practice]. Impacts are
+ the loudest SFX. Whooshes sit under the picture (src 1).
+- One element owns the sub at a time. High-pass everything else. Check the mono fold-down; phones are mono.
+- Sync: viewers detect sound 45 ms *early* or 125 ms *late* (ITU-R BT.1359). EBU R37 allows +40 / −60 ms end to end
+ (src 38). A frame is 33 ms at 30 fps, so align the perceived onset or peak to the exact frame. If in doubt, let the
+ sound lead by up to 1 frame; never let it lag by 2 or more [sv]. Align samples on their attack, not their file
+ start (earshot).
+- Leave room: silence before a big moment is part of the sound (src 11, 18).
+
+---
+
+## 14. The cheap-SFX checklist (all categories)
+
+Each item is phrased so a recipe or critic can measure it:
+
+1. **One layer**, or layers whose peaks are not aligned (src 1, 2, 10).
+2. **No movement**: a static spectrum and static pan on anything that moves (src 1).
+3. **Linear curves** on risers and sweeps, where the pros use accelerating or exponential ones (src 7).
+4. **Mud**: excess energy at 200-400 Hz (src 41), or two layers fighting in one band (src 10).
+5. **Weak or blurry attack**: an over-compressed bus, or a slow onset where a crack belongs (src 10, 41).
+6. **Too long**: UI cues over ~150 ms, notifications over ~500 ms (src 16), tails that run into the next event (src 4).
+7. **Bad low end**: below 25 Hz (src 10); a pure-sine sub with no harmonics (src 12, 37); an untuned sub (src 10);
+ reverb on the sub.
+8. **Harshness**: unfiltered white noise (src 1), 2-5 kHz peaks on UI sounds (src 16), stacked crush and aliasing
+ (src 29). A naive oscillator folds over (`polish.py` checks it).
+9. **Artifacts**: clicks at edges or splices, DC, chopped tails, leading silence (src 16, `polish.py`).
+10. **Inconsistency**: a family of sounds at different loudnesses or timbres (src 16). Pitches not in the music's key.
+11. **Overuse**: the same whoosh or riser on every cut (src 4, 7), sound on every micro-motion (src 18), hover sounds.
+12. **Wrong size or texture** for the object on screen (src 49b, search summary). Big means lower, slower and wider;
+ small means higher, faster and tighter (src 42).
+13. **Off sync** by a frame or more (src 42, 38).
+14. **Mono-incompatible width** that vanishes on phones (src 4).
+15. **Judged in solo only**. Audition against music and on small speakers (src 16, 29).
+
+---
+
+## 15. What this means for earshot forge recipes
+
+1. **Add a design stage to every motion recipe.** Keep the physical model as a source layer. Add the category's other
+ layers (sections 1-12) and the universal chain (section 0), built from `fx.py`. A recipe's parameters should include
+ per-layer levels, saturation drive, bus glue amount, reverb send and pre-delay, and the edit length.
+2. **Expose sync parameters.** Duration and peak time (whoosh, riser, downlifter, sub drop), the hit frame (impact,
+ sting) and note or key (anything tonal or with a sub), so a film can request "a 0.48 s whoosh peaking at 0.30 s in
+ D minor".
+3. **Expose family parameters.** A `family` seed that fixes timbre (modal set, FM ratio, filter character) across a
+ set, while per-render seeds vary only force, timing and noise. That gives a consistent UI palette and safe round
+ robins.
+4. **Reference sets should be designed library SFX** of the target style (motion-design packs: digital, tonal, UI,
+ glitch, impact, notification and whoosh categories, src 44), not raw foley. A model trained on "real vs synthetic"
+ rewards a mic noise floor and room tone, which a designed motion SFX does not have.
+5. **Measurable targets from this page** (for the critic or the polish checks):
+ - peak position as a fraction of the length (whoosh 0.5-0.7);
+ - curve shape (riser change concentrated in the last 25 %);
+ - band shares (UI: little below 120-150 Hz; pops: little below 150 Hz or above 4 kHz; impact: sub, body and
+ transient bands all present);
+ - attack time (clicks < 2 ms to peak);
+ - durations per category (sections 1-12);
+ - tonal pitch inside 125 Hz-5 kHz for earcons;
+ - loudness spread across a family;
+ - mono-fold loss.
+
+---
+
+## References
+
+Tutorials and articles (read with WebFetch unless marked "search summary", which means only a search engine's
+summary of the page was available, so treat those numbers as softer):
+
+1. Violet Recording, *How to Make Whoosh Sounds*. https://violetrecording.com/how-to-make-whoosh-sounds/
+2. Krotos, *Whoosh Sound Effects - Tutorial*. https://sound.krotosaudio.com/?p=1555
+3. Krotos Studio, *4 whoosh sound effects tips*. https://webflow.krotos.studio/guide/4-whoosh-sound-effects-tips
+ ("bigger = lower and slower" is from a Krotos article seen only in a search summary:
+ https://www.krotosaudio.com/?p=1006981)
+4. Sonilo, *Whoosh sound effect guide* (motion and editing). https://sonilo.com/ai-music/whoosh-sound-effect-guide
+5. Designing Sound, *Whoosh review* (Tonsturm Whoosh: source samplers, Doppler engine, impact layer, sidechain).
+ https://designingsound.org/2014/02/whoosh-review
+6. Unison Audio, *How to create risers*. https://unison.audio/how-to-create-risers/
+7. Violet Recording, *How to Make Risers and Sweeps*. https://violetrecording.com/how-to-make-risers-and-sweeps/
+8. Soundbridge, *Transition effects* (noise sweep, pitch up, pitch-down impact in Massive).
+ https://www.soundbridge.io/transition-effects
+9. Ableton, *Learn How to Make High-Impact Sounds for Movies and Trailers*.
+ https://www.ableton.com/en/blog/learn-how-to-make-high-impact-sounds-for-movies-and-trailers/
+10. Violet Recording, *How to Make Impact and Hit Sounds*. https://violetrecording.com/how-to-make-impact-sounds/
+11. IRPR Sound Design, *Weak trailer impact*. https://sounddesign.irpr.agency/solutions/weak-trailer-impact/
+12. IRPR Sound Design, *Sub drop* (glossary). https://sounddesign.irpr.agency/glossary/sub-drop/
+13. Attack Magazine, *Synth Secrets: 808-style booms*.
+ https://www.attackmagazine.com/technique/synth-secrets/808-style-booms/
+14. 808 / sub tutorials (search summary across several pages; numbers are one author's each): Ableton forum,
+ https://forum.ableton.com/viewtopic.php?p=873995; Unison, https://unison.audio/808-sound-design/; ADSR Sounds,
+ https://www.adsrsounds.com/ni-massive-tutorials/making-an-ni-massive-808-kick-drum/
+15. Andy Farnell, *Designing Sound* (MIT Press), Pure Data practicals (patch values read from the code listings):
+ index https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/8375/designing_sound.zip/index.html
+ - 04 Alarm and menu sounds: .../practical04.html
+ - 06 Telephone bell: .../practical06.html
+ - 12 Bubbles: .../practical12.html
+ - 18 Wind: .../practical18.html
+ - 19 Switches: .../practical19.html
+ - 31 Explosions: .../practical31.html
+ - 33 Transporter: .../practical33.html
+ - 34 R2D2: .../practical34.html
+16. Violet Recording, *How to Design UI and App Sounds*. https://violetrecording.com/how-to-design-ui-sounds/
+17. Brewster, Wright & Edwards, *Guidelines for the creation of earcons* (University of Glasgow).
+ https://www.dcs.gla.ac.uk/~stephen/earcon_guidelines.shtml
+18. Google Design, *Good Vibrations* (sound and haptics, Super G, silence as negative space).
+ https://design.google/library/ux-sound-haptic-material-design
+19. Google Design, *Conor O'Sullivan on Pixel sound design*.
+ https://design.google/library/google-pixel-sound-design-ux-conor-osullivan
+20. Material Design 2, *Applying sound to UI* / *About sound* (sound hierarchy; the pages need JavaScript, so search
+ summary). https://m2.material.io/design/sound/applying-sound-to-ui.html,
+ https://m2.material.io/design/sound/about-sound.html
+21. Windows Central, *Microsoft rounded sounds, not just corners, when designing Windows 11* (search summary).
+ https://www.windowscentral.com/microsoft-rounded-sounds-not-just-corners-when-designing-windows-11
+22. Game UI sound guidance (search summaries): GameDev.net, *What was that noise? Mastering creative UI sound design
+ with intention*,
+ https://gamedev.net/news/5816-what-was-that-noise-mastering-creative-ui-sound-design-with-intention/; Audiokinetic,
+ *Approaching UI Audio from a UI Design Perspective* (parts 1-2; the page returned 403),
+ https://www.audiokinetic.com/en/blog/approaching-ui-audio-ui-design-perspective-1
+23. sccode.org, FM click / UI SynthDef (SuperCollider). https://sccode.org/1-5bj
+24. University of Victoria, MU307 *Tutorial: Synthesis - Frequency modulation*.
+ https://web.uvic.ca/~aschloss/course_mat/MU307/MU307%20Labs/Tutorial%20FM.htm
+ 24b. VI-Control forum, *Which tools do you use to create UI sound effects for games* (search summary).
+ https://vi-control.net/community/threads/which-tools-do-you-use-to-create-ui-sound-effects-for-games.152737/
+25. Violet Recording, *How to Use FM Synthesis for Sound Design* (search summary).
+ https://violetrecording.com/how-to-use-fm-synthesis-for-sound-design/
+26. Sound On Sound, *Synth Secrets: Synthesizing Bells* (bell partials 2:3:4 strike, FM cymbal from three pulse
+ pairs; most numbers are only in its figures). https://www.soundonsound.com/techniques/synthesizing-bells
+27. Shimmer reverb (search summaries): Sequential forum,
+ https://forum.sequential.com/index.php/topic,2071.msg23030.html; Reason Studios, *Building shimmer reverb*,
+ https://reasonstudios.com/news/post/building-shimmer-reverb
+28. SampleFocus, *5 Essential Techniques for Creating Glitch Sound Effects*.
+ https://samplefocus.com/blog/5-essential-techniques-for-creating-glitch-sound-effects/
+29. Violet Recording, *How to Make Glitch Sounds*. https://violetrecording.com/how-to-make-glitch-sounds/
+30. Native Instruments, *Glitch effects*. https://blog.native-instruments.com/glitch-effects/
+31. Keyboard acoustic emanations (search summaries of Zhuang, Zhou & Tygar, *Keyboard Acoustic Emanations Revisited*,
+ and Asonov & Agrawal, *Keyboard Acoustic Emanations*): survey https://arxiv.org/pdf/2309.11012; paper copies
+ https://www.cs.toronto.edu/~scottl/research/keyboard_emanations.pdf,
+ https://davidsalomon.name/CompSec/auxiliary/KybdEmanation.pdf (the PDFs could not be read as text)
+32. Netflix "ta-dum" (search summaries): Twenty Thousand Hertz, https://www.20k.org/episodes/netflix; Boing Boing,
+ https://boingboing.net/2020/08/07/ta-dum-how-the-netflix-sound.html/amp
+33. Sonic logo length (vendor sources, search summary): https://www.heardis.com/services/sound-logo/,
+ https://origin-brandworld.lenovo.com/sonic-identity/, https://www.artyfile.com/blog/audio-branding-audio-logos-guide
+34. Wikipedia, *Deep Note*. https://en.wikipedia.org/wiki/Deep_Note
+35. Wikipedia, *Shepard tone*. https://en.wikipedia.org/wiki/Shepard_tone
+36. Wikipedia, *Precedence effect*. https://en.wikipedia.org/wiki/Precedence_effect
+37. Wikipedia, *Missing fundamental*. https://en.wikipedia.org/wiki/Missing_fundamental
+38. Wikipedia, *Audio-to-video synchronization* (ITU-R BT.1359, EBU R37, ATSC IS-191).
+ https://en.wikipedia.org/wiki/Audio-to-video_synchronization
+39. Wikipedia, *Doppler effect* (standard formula; not fetched). https://en.wikipedia.org/wiki/Doppler_effect
+40. Amped Studio, *Reverse reverb* (search summary). https://ampedstudio.com/blog/reverse-reverb/
+41. Pitch Innovations, *Why Some Sounds Feel Expensive (Even When They're Not)*.
+ https://pitchinnovations.com/blog/why-some-sounds-feel-expensive-even-when-theyre-not/
+42. Violet Recording, *Sound Design for Animation*. https://violetrecording.com/sound-design-for-animation/
+43. IRPR Sound Design, *Motion graphics*. https://sounddesign.irpr.agency/applications/motion-graphics/
+44. AEJuice, *Motion Design Sound Effects* (category structure of a motion-design SFX pack: digital, tonal, UI elements,
+ UI notification, glitch, impact, whoosh, data, paper; stems plus pre-mixed designs).
+ https://aejuice.com/product/motion-design-sound-effects/
+45. Bubble acoustics background: van den Doel, *Physically-based models for liquid sounds* (record),
+ https://repository.gatech.edu/entities/publication/dcc121b6-5fdb-42db-b758-971522f01c70; Cornell bubble sound
+ project, https://research.cs.cornell.edu/Sound/bubbles/ (the Minnaert relation itself is from earshot `pop.py`)
+46. UI cue durations and fatigue (search summaries; the "a tap is heard thousands of times, so a tail, melody or
+ personality becomes irritating" point is from one of these): Morphic, *Interface sound effects*,
+ https://morphic.com/resources/sounds/interface-sound-effects; IRPR, *UI sounds annoying*,
+ https://sounddesign.irpr.agency/solutions/ui-sounds-annoying/
+ 46c. UI sound design agent skill (category table: clicks 10-80 ms; search summary).
+ https://agentskills.so/skills/dannyjpwilliams-ui-sound-design-skill-ui-sound-design
+47. Morphic, *Magic sound effects* (category descriptions only, search summary).
+ https://morphic.com/resources/sounds/magic-sound-effects
+48. Violet Recording, *How to Design an 808 From Scratch*. https://violetrecording.com/how-to-design-an-808/
+49. Downlifter forum answer (search summary): Gearspace, https://gearspace.com/threads/total-newbie-needs-some-basic-help.891066/
+ 49b. IRPR on SFX that feel too small, too synthetic or the wrong texture for the action (search summary):
+ https://sounddesign.irpr.agency/solutions/sfx-dont-match-picture/
+50. ADSR Sounds, *FX with Massive part 2: downlifter* (search summary).
+ https://www.adsrsounds.com/ni-massive-tutorials/fx-with-massive-part-2-downlifter/
+51. Morphic, *Tape stop sound effects* (search summary). https://morphic.com/resources/sounds/tape-stop-sound-effects
+
+earshot internal: `docs/launch-video-sound.md` (measurements of 7 pro launch films), and the measured notes in
+`earshot/forge/recipes/{click,keypress,pop,whoosh,impact,pluck}.py`.
diff --git a/eval/forge/pro/crops_batch.py b/eval/forge/pro/crops_batch.py
new file mode 100644
index 0000000..370dfe2
--- /dev/null
+++ b/eval/forge/pro/crops_batch.py
@@ -0,0 +1,17 @@
+"""Many zoomed crop sheets in one process (python start-up is slow on the shared laptop).
+
+ python eval/forge/pro/crops_batch.py specs.json
+specs.json: [{"ref": "ref_2", "out": "ref_2_a", "cols": 3, "specs": [[t_center, half_width, "label"], ...]}, ...]
+"""
+import json
+import os
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+import viewer # noqa: E402
+from videos import WORK # noqa: E402
+
+for job in json.load(open(sys.argv[1], encoding='utf-8')):
+ out = f"{WORK}/view/{job['out']}.png"
+ print(viewer.crops(job['ref'], [tuple(s) for s in job['specs']], cols=job.get('cols', 3), out=out), flush=True)
diff --git a/eval/forge/pro/events.py b/eval/forge/pro/events.py
new file mode 100644
index 0000000..5d469dd
--- /dev/null
+++ b/eval/forge/pro/events.py
@@ -0,0 +1,97 @@
+"""Curated sound-design events in the reference films (picked by looking at earshot sheets, overview pages and zoomed
+spectrogram crops; times in seconds of the film's own audio). Film ids only (ref_1..ref_8): see videos.py.
+
+EVENTS rows: (film, t0, t1, category, picture cut or None, note, bed window or None)
+ note starting with 'noexp' = measured for the study but not exported as a reference (masked / contaminated)
+ bed None = the quietest 150 ms in the 0.6 s before t0 (measure.quiet_bed)
+Categories follow earshot.forge.refsets.CATEGORIES, plus three the films use a lot that the forge list lacks:
+ pop_in a designed micro-hit for an element appearing: a short low thump (70-200 Hz) fused with a short noise burst
+ (60-150 ms), usually fired in rhythmic runs (one per element)
+ zip a fast tonal pitch sweep (a sine / saw glide, 0.1-0.4 s), up for 'in', down for 'out'
+ typing_run a run of designed typing ticks (whole run, 0.5-2 s)
+"""
+
+SPLIT = { # film -> split for EVERY category (no film feeds both sides)
+ 'ref_1': 'bench', 'ref_2': 'forge', 'ref_3': 'forge', 'ref_4': 'bench',
+ 'ref_5': 'bench', 'ref_6': 'bench', 'ref_7': 'forge', 'ref_8': 'bench',
+}
+
+NOTES = {
+ 'whoosh_big': 'forge only (one SFX-only film); the bench films bury their whooshes under music + voice.',
+ 'impact': 'forge only (one SFX-only film); designed, sub-heavy, gated tails.',
+ 'shimmer': 'forge only; one granular sparkle + one melodic chime run.',
+ 'glitch': 'forge only, one example.', 'notify': 'forge only.', 'tap': 'forge only, one example.',
+ 'pop_in': 'not a forge category yet: element-in micro hits (thump + tick), forge only.',
+ 'typing_run': 'not a forge category yet: one whole designed typing run.',
+ 'zip': 'not a forge category yet: tonal pitch sweeps, bench only (two films over music).',
+ 'sub_drop': 'bench only, one example under music + voice.',
+ 'riser': 'forge: one designed stutter riser; bench: one noise riser at a film end.',
+ 'logo_sting': 'forge: falling chirp into a tonal hum; bench: a music end chord with a 4 s tail.',
+}
+
+EVENTS = [
+ # ---- ref_2: a pure sound-design piece (no music bed), the cleanest examples
+ ('ref_2', 2.30, 2.82, 'whoosh_big', 2.88, 'low swell into the cut (ends before the clicks that follow)'),
+ ('ref_2', 8.28, 9.30, 'whoosh_big', 8.64, 'soft round whoosh, peak just after the cut'),
+ ('ref_2', 11.55, 12.62, 'whoosh_big', 12.64, 'noexp soft swell under the typing run (clicks on top)'),
+ ('ref_2', 4.715, 5.95, 'impact', None, 'hit + granular low rumble tail, gated end'),
+ ('ref_2', 14.02, 14.62, 'impact', 14.28, 'hit with sustained air, hard gated end'),
+ ('ref_2', 16.78, 17.62, 'riser', 17.6, 'stutter-gated rising tone over a drone, peaks on the cut'),
+ ('ref_2', 6.15, 8.10, 'shimmer', None, 'granular sparkle texture, swells and fades'),
+ ('ref_2', 24.25, 26.20, 'shimmer', None, 'melodic chime run, gated end'),
+ ('ref_2', 27.90, 28.60, 'glitch', 28.6, 'crackle then dense stutter, ends on the cut'),
+ ('ref_2', 28.62, 29.45, 'logo_sting', 28.6, 'falling chirp into a low tonal hum', (26.5, 27.8)),
+ ('ref_2', 13.10, 13.25, 'pop', None, 'falling chirp pop (10 kHz -> low)'),
+ ('ref_2', 13.295, 13.37, 'pop', None, 'short knock pop ~1.3 kHz'),
+ ('ref_2', 15.275, 15.50, 'notify', None, 'ding'),
+ ('ref_2', 15.553, 15.80, 'notify', None, 'ding'),
+ ('ref_2', 15.840, 16.20, 'notify', None, 'ding'),
+ ('ref_2', 16.275, 16.55, 'notify', None, 'ding / glass'),
+ ('ref_2', 18.705, 18.80, 'tap', 18.8, 'low thump + click'),
+ ('ref_2', 2.938, 3.02, 'click', None, 'noexp bright click pair inside a chime texture'),
+ ('ref_2', 3.849, 3.90, 'click', None, 'broadband click'),
+ ('ref_2', 3.766, 3.845, 'hover_tick', None, 'high tonal tick'),
+ ('ref_2', 3.905, 3.96, 'hover_tick', None, 'high tonal tick'),
+ ('ref_2', 4.028, 4.10, 'hover_tick', None, 'high tonal tick'),
+ ('ref_2', 10.458, 10.53, 'typing_key', None, 'designed typing tick (high-passed)'),
+ ('ref_2', 10.686, 10.78, 'typing_key', None, ''),
+ ('ref_2', 10.797, 10.88, 'typing_key', None, ''),
+ ('ref_2', 11.130, 11.20, 'typing_key', None, ''),
+ ('ref_2', 11.464, 11.54, 'typing_key', None, ''),
+ ('ref_2', 11.551, 11.61, 'typing_key', None, ''),
+ ('ref_2', 10.40, 11.95, 'typing_run', 10.68, 'whole designed typing run'),
+ ('ref_2', 20.109, 20.25, 'pop_in', 20.08, 'element-in micro hit'),
+ ('ref_2', 20.632, 20.79, 'pop_in', None, ''),
+ ('ref_2', 21.105, 21.30, 'pop_in', None, ''),
+ ('ref_2', 21.313, 21.58, 'pop_in', None, ''),
+ ('ref_2', 21.826, 22.03, 'pop_in', None, ''),
+ ('ref_2', 22.617, 22.81, 'pop_in', None, ''),
+ ('ref_2', 22.821, 23.04, 'pop_in', None, ''),
+ ('ref_2', 23.044, 23.22, 'pop_in', None, ''),
+ ('ref_2', 23.226, 23.41, 'pop_in', None, ''),
+ ('ref_2', 23.421, 23.60, 'pop_in', 23.4, ''),
+ # ---- ref_6: kinetic type cut to the beat (music bed); designed zips and opening UI ticks
+ ('ref_6', 1.60, 1.86, 'zip', 1.64, 'upward tonal sweep over the bed'),
+ ('ref_6', 3.78, 4.06, 'zip', 4.04, 'upward sweep 100 Hz -> 10 kHz, ends on the cut'),
+ ('ref_6', 0.100, 0.150, 'hover_tick', None, 'high noise tick 3-12 kHz over a near-silent bed'),
+ ('ref_6', 0.205, 0.240, 'click', 0.24, 'broadband click'),
+ ('ref_6', 0.343, 0.385, 'hover_tick', None, 'high noise tick'),
+ ('ref_6', 0.588, 0.625, 'hover_tick', None, 'mid-high tick (2 kHz centred)'),
+ # ---- ref_5: explainer, voice-over + music + UI sounds
+ ('ref_5', 2.825, 2.88, 'click', None, 'broadband click with a low body, over music'),
+ ('ref_5', 16.835, 16.96, 'pop', None, 'tonal blip ~1.5 kHz + a click, over music'),
+ ('ref_5', 22.80, 22.98, 'zip', 22.9, 'falling tonal sweep 8 kHz -> 200 Hz over the cut'),
+ ('ref_5', 28.22, 28.48, 'zip', None, 'arc sweep up then down (1 -> 3 -> 1 kHz)'),
+ # ---- ref_7: aggressive music wall to wall; a noise riser into a drop, the opening drop hit
+ ('ref_7', 26.90, 27.48, 'riser', 27.7, 'noexp noise riser into the drop, only +5 dB over the music (part of it)', (26.40, 26.85)),
+ ('ref_7', 1.625, 2.10, 'impact', 1.767, 'noexp drop hit, the music enters with it', (1.0, 1.55)),
+ # ---- ref_8: long voice-over product film over music; few exposed effects
+ ('ref_8', 85.58, 86.45, 'sub_drop', 85.627, 'sub tone under the cut with a bright transient on top'),
+ ('ref_8', 88.76, 93.00, 'logo_sting', None, 'end hit + long ringing chord tail (music-like)'),
+ ('ref_8', 32.570, 32.612, 'click', None, 'noexp click in a voice-over gap, only +3 dB over the bed'),
+ ('ref_8', 32.680, 32.76, 'typing_key', None, 'key tick in a voice-over gap'),
+ # ---- ref_1: voice-over + music; the exposed ending riser, whooshes masked
+ ('ref_1', 19.30, 20.45, 'riser', None, 'noise riser to the end of the film', (18.6, 19.2)),
+ ('ref_1', 10.90, 11.30, 'whoosh_big', 11.053, 'noexp masked by a music onset'),
+ ('ref_1', 5.95, 6.60, 'whoosh_big', 6.381, 'noexp masked by music + voice'),
+]
diff --git a/eval/forge/pro/extra.py b/eval/forge/pro/extra.py
new file mode 100644
index 0000000..3a9321d
--- /dev/null
+++ b/eval/forge/pro/extra.py
@@ -0,0 +1,91 @@
+"""Targeted extra measurements for the study doc: tonal sweep ridges in a band (zips, the riser's tonal layer, the
+sting's chirp) and pulse rates of gated / stuttered events (peaks of the 2 ms high-band envelope).
+
+ python eval/forge/pro/extra.py
+"""
+import os
+import sys
+
+import numpy as np
+import soundfile as sf
+from scipy import signal
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from videos import wav # noqa: E402
+
+SR = 48000
+
+
+def mono(ref, a, b):
+ x, _ = sf.read(wav(ref), dtype='float64', always_2d=True, start=int(a * SR), stop=int(b * SR))
+ return x.mean(1)
+
+
+def ridge(ref, a, b, fmin, fmax, hop_ms=5, n=1024, rel_db=18):
+ m = mono(ref, a, b)
+ f, t, Z = signal.stft(m, SR, nperseg=n, noverlap=n - int(SR * hop_ms / 1000), nfft=8192)
+ P = np.abs(Z) ** 2
+ k = (f >= fmin) & (f <= fmax)
+ pk = f[k][np.argmax(P[k], 0)]
+ lv = 10 * np.log10(P[k].max(0) + 1e-14)
+ ok = lv >= lv.max() - rel_db
+ tt = a + t[ok]
+ ff = pk[ok]
+ return tt, ff
+
+
+def pulses(ref, a, b, lo=2000, hi=16000, min_gap_ms=15):
+ m = mono(ref, a, b)
+ sos = signal.butter(4, [lo, hi], 'bandpass', fs=SR, output='sos')
+ y = signal.sosfiltfilt(sos, m)
+ n = int(0.002 * SR)
+ k = len(y) // n
+ e = 10 * np.log10((y[:k * n].reshape(k, n) ** 2).mean(1) + 1e-14)
+ pk, _ = signal.find_peaks(e, prominence=6, distance=int(min_gap_ms / 2))
+ ts = a + pk * 0.002
+ return ts
+
+
+def show_ridge(name, ref, a, b, fmin, fmax):
+ tt, ff = ridge(ref, a, b, fmin, fmax)
+ if len(tt) < 2:
+ print(name, 'no ridge')
+ return
+ q = max(1, len(ff) // 6)
+ f0, f1 = np.median(ff[:q]), np.median(ff[-q:])
+ span = tt[-1] - tt[0]
+ oc = np.log2(f1 / f0)
+ print(f'{name:28s} {ref} {a:.2f}-{b:.2f}: ridge {f0:.0f} Hz -> {f1:.0f} Hz ({oc:+.2f} oct over {span * 1000:.0f} ms, '
+ f'{oc / max(span, 1e-3):+.1f} oct/s), min {ff.min():.0f} max {ff.max():.0f}; '
+ f'samples {[(round(t, 3), int(f)) for t, f in list(zip(tt, ff))[::max(1, len(tt) // 8)]]}')
+
+
+def show_pulses(name, ref, a, b, **kw):
+ ts = pulses(ref, a, b, **kw)
+ if len(ts) < 3:
+ print(name, 'few pulses', ts)
+ return
+ d = np.diff(ts) * 1000
+ print(f'{name:28s} {ref} {a:.2f}-{b:.2f}: {len(ts)} pulses, interval median {np.median(d):.0f} ms '
+ f'(rate {1000 / np.median(d):.1f}/s), first half {np.median(d[:len(d) // 2]):.0f} ms, second half '
+ f'{np.median(d[len(d) // 2:]):.0f} ms')
+
+
+if __name__ == '__main__':
+ show_ridge('zip up (ref_6 a)', 'ref_6', 1.60, 1.86, 250, 4000)
+ show_ridge('zip up (ref_6 b)', 'ref_6', 3.78, 4.06, 250, 14000)
+ show_ridge('zip down (ref_5 a)', 'ref_5', 22.80, 22.98, 250, 12000)
+ show_ridge('zip arc (ref_5 b)', 'ref_5', 28.22, 28.48, 250, 6000)
+ show_ridge('riser tonal layer (ref_2)', 'ref_2', 16.85, 17.55, 1500, 12000)
+ show_ridge('pop chirp (ref_2)', 'ref_2', 13.10, 13.22, 200, 14000)
+ show_ridge('sting chirp (ref_2)', 'ref_2', 28.60, 28.75, 80, 6000)
+ show_ridge('sting hum (ref_2)', 'ref_2', 28.75, 29.40, 60, 600)
+ show_ridge('sub drop (ref_8)', 'ref_8', 85.62, 86.40, 25, 120)
+ show_ridge('notify fundamental (ref_2)', 'ref_2', 15.28, 15.45, 600, 9000)
+ show_pulses('riser stutter (ref_2)', 'ref_2', 16.78, 17.55, lo=1000)
+ show_pulses('glitch stutter (ref_2)', 'ref_2', 28.10, 28.60)
+ show_pulses('typing run (ref_2)', 'ref_2', 10.40, 11.95)
+ show_pulses('pop_in run (ref_2)', 'ref_2', 20.05, 23.60, lo=40, hi=400, min_gap_ms=60)
+ show_pulses('impact rumble grains (ref_2)', 'ref_2', 4.80, 5.90, lo=40, hi=600, min_gap_ms=20)
+ show_pulses('shimmer grains (ref_2)', 'ref_2', 6.15, 8.10, lo=1500, hi=16000, min_gap_ms=10)
diff --git a/eval/forge/pro/film_table.py b/eval/forge/pro/film_table.py
new file mode 100644
index 0000000..57c6568
--- /dev/null
+++ b/eval/forge/pro/film_table.py
@@ -0,0 +1,42 @@
+"""Film-level numbers from the earshot timelines of the reference films: loudness, cut rate, sync of cuts, tempo.
+
+ python eval/forge/pro/film_table.py # prints a Markdown table, writes out/refs_pro/films.json
+"""
+import json
+import os
+import sys
+
+import numpy as np
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from videos import OUT, VIDEOS, WORK # noqa: E402
+
+rows = []
+for ref in sorted(VIDEOS):
+ r = json.load(open(f'{WORK}/tl/{ref}.json', encoding='utf-8'))
+ st = r['sync']['cuts']['stats'] if r.get('sync', {}).get('cuts') else {}
+ items = r['sync']['cuts']['items'] if r.get('sync', {}).get('cuts') else []
+ offs = [i['offset_ms'] for i in items if i.get('offset_ms') is not None and i['status'] in ('OK', 'near')]
+ m = r.get('music') or {}
+ secs = ' / '.join(s.get('label', '')[:60] for s in r.get('sections', [])[:2])
+ voice = any('voice' in (s.get('label') or '') for s in r.get('sections', []))
+ row = {'film': ref, 'dur_s': round(r['duration'], 1), 'lufs': r['loudness'].get('integrated_lufs'),
+ 'tp_dbtp': r['loudness'].get('true_peak_dbtp'), 'lra': r['loudness'].get('lra_lu'),
+ 'cuts': len(r.get('cuts') or []), 'cuts_per_s': round(len(r.get('cuts') or []) / r['duration'], 2),
+ 'tempo': m.get('tempo'), 'pulse': m.get('pulse_clarity'), 'events_per_s': round(len(r['events']) / r['duration'], 1),
+ 'hit_1f': st.get('hit_within_1_frame'), 'chance_1f': st.get('chance_within_1_frame'),
+ 'hit_100ms': st.get('hit_within_100ms'), 'accent_1f': st.get('accent_within_1_frame'),
+ 'accent_chance_1f': st.get('accent_chance_within_1_frame'),
+ 'median_offset_ms': float(np.median(offs)) if offs else None,
+ 'early_share': round(float(np.mean([o < 0 for o in offs])), 2) if offs else None,
+ 'voice_over': voice, 'sections': secs}
+ rows.append(row)
+with open(f'{OUT}/films.json', 'w', encoding='utf-8') as fh:
+ json.dump(rows, fh, indent=1)
+print('| film | dur s | LUFS | LRA | cuts/s | tempo | VO | cut answered within 1 frame (chance) | strong accent within 1 frame (chance) | median signed offset ms (OK/near) |')
+print('|---|---|---|---|---|---|---|---|---|---|')
+for w in rows:
+ print(f"| {w['film']} | {w['dur_s']} | {w['lufs']} | {w['lra']} | {w['cuts_per_s']} | "
+ f"{round(w['tempo']) if w['tempo'] else '-'} (pulse {w['pulse']}) | {'yes' if w['voice_over'] else 'no'} | "
+ f"{w['hit_1f']} ({w['chance_1f']}) | {w['accent_1f']} ({w['accent_chance_1f']}) | {w['median_offset_ms']} |")
diff --git a/eval/forge/pro/measure.py b/eval/forge/pro/measure.py
new file mode 100644
index 0000000..d967337
--- /dev/null
+++ b/eval/forge/pro/measure.py
@@ -0,0 +1,314 @@
+"""Measurements of one sound-design event inside a finished film mix (music bed underneath), bed-subtracted.
+
+ from measure import measure
+ m = measure(x, t0, t1, bed=(b0, b1), cut=6.38) # x = stereo float array at 48 kHz, times in seconds
+
+The bed is the mix just before the event (default: the quietest 150 ms in the 0.6 s before t0, quiet_bed()). Everything that can be is measured
+on (event power - bed power), so the music under the event mostly drops out; where the event does not rise over the bed
+in a band, that band is 'masked' (floored) and says nothing about the event.
+
+Returned (all plain floats / lists, JSON-ready):
+ dur_s, bed_lufs (K-weighted mean level of the bed, ~LUFS; bed_silent when < -60), ev_lufs (same over the event's loudest 100 ms),
+ over_bed_db (ev_lufs - bed_lufs, a silent bed counted as -70: 'how far it sticks out of the music'),
+ snr_db (bed-subtracted event power / bed power over the whole event window, broadband),
+ third_oct: {centres, ev_db (event power per band, dB re its total), bed_db (same scale), excess_db (ev - bed in each
+ band), masked (bands where the event adds < 1 dB)}, tilt_db_oct (slope of the bed-subtracted balance,
+ 100 Hz - 10 kHz, least squares), shares (5 broad regions, dB of total: <150, 150-1k, 1-4k, 4-12k, >12k),
+ attack_ms (from the first ms within 20 dB of the peak to the peak, 1 ms bed-subtracted envelope), rise_ms (10 -> 90 %
+ amplitude), t_peak (s, absolute), peak_frac (where in [t0, t1] the peak sits),
+ t20_ms / t40_ms (peak -> first fall 20 / 40 dB under it; None when the bed comes first), decay_db_s (fit over the
+ first 20 dB of the fall), decay_shape ('exp' = straight in dB, 'convex' = holds then drops (gated / faded),
+ 'concave' = drops fast then a long tail (reverb)),
+ centroid: start / peak / end (Hz, bed-subtracted, frames >= -20 dB re peak), sweep_oct (end - start in octaves),
+ sweep_oct_s, the 20 ms track (t, Hz)
+ f0_track (dominant peak of the 20-250 Hz band per 20 ms frame, for sub drops / booms: start, end, octaves),
+ stereo: side_mid_db (bed-subtracted side / mid power), corr (L/R correlation of the event window), pan_db range
+ (L-R level difference over 20 ms frames: min, max, travel), width words
+ cut_ms: t_peak - cut and t_attack_start - cut (ms) when a cut is given
+"""
+import numpy as np
+from scipy import signal
+
+SR = 48000
+CENTRES = [1000 * 2 ** (k / 3) for k in range(-16, 13)] # 25 Hz ... 16 kHz (29 bands)
+KW = [((1.53512485958697, -2.69169618940638, 1.19839281085285), (1.0, -1.69065929318241, 0.73248077421585)),
+ ((1.0, -2.0, 1.0), (1.0, -1.99004745483398, 0.99007225036621))]
+REGIONS = [(0, 150), (150, 1000), (1000, 4000), (4000, 12000), (12000, 24000)]
+
+
+def kweight(m):
+ y = m
+ for b, a in KW:
+ y = signal.lfilter(b, a, y)
+ return y
+
+
+def _seg(x, a, b):
+ return x[max(0, int(round(a * SR))):max(0, int(round(b * SR)))]
+
+
+def _psd(m, nfft=None):
+ """mean power per sample spectrum (Hann, zero-padded), returns f, P such that sum(P) ~ mean(m**2)"""
+ n = len(m)
+ nfft = nfft or max(8192, 1 << int(np.ceil(np.log2(max(n, 2)))))
+ w = np.hanning(n)
+ X = np.fft.rfft(m * w, nfft)
+ P = np.abs(X) ** 2 / (np.sum(w ** 2) * n) * n / 1.0
+ P[1:-1] *= 2
+ P /= n
+ f = np.fft.rfftfreq(nfft, 1 / SR)
+ return f, P
+
+
+def _bands(f, P):
+ out = []
+ for c in CENTRES:
+ lo, hi = c * 2 ** (-1 / 6), c * 2 ** (1 / 6)
+ k = (f >= lo) & (f < hi)
+ out.append(P[k].sum() if k.any() else P[np.argmin(np.abs(f - c))])
+ return np.array(out)
+
+
+def _env_db(m, ms=1.0):
+ n = max(1, int(SR * ms / 1000))
+ k = len(m) // n
+ return 10 * np.log10((m[:k * n].reshape(k, n) ** 2).mean(1) + 1e-14)
+
+
+def _frames(m, ms=20.0):
+ n = int(SR * ms / 1000)
+ k = len(m) // n
+ return m[:k * n].reshape(k, n), n
+
+
+def quiet_bed(x, t0, search=0.6, win=0.15, gap=0.015):
+ """the bed under an event: the quietest `win` s (K-weighted power, 10 ms hop) in the `search` s before it (so a
+ run of clicks or a previous hit does not count as bed); shorter at the start of a file"""
+ a, b = max(0.0, t0 - search), max(0.0, t0 - gap)
+ if b - a <= win:
+ return (a, b) if b - a >= 0.03 else (a, max(b, a + 0.03))
+ k = kweight(_seg(x, a, b).mean(1)) ** 2
+ n, h = int(win * SR), int(0.01 * SR)
+ c = np.cumsum(np.concatenate([[0.0], k]))
+ starts = np.arange(0, len(k) - n + 1, h)
+ p = (c[starts + n] - c[starts]) / n
+ i = int(starts[int(np.argmin(p))])
+ return (round(a + i / SR, 4), round(a + (i + n) / SR, 4))
+
+
+def measure(x, t0, t1, bed=None, cut=None):
+ x = np.asarray(x, np.float64)
+ if x.ndim == 1:
+ x = np.stack([x, x], 1)
+ if bed is None:
+ bed = quiet_bed(x, t0)
+ ev = _seg(x, t0, t1)
+ bd = _seg(x, *bed)
+ if len(bd) < int(0.02 * SR):
+ bd = np.zeros((int(0.05 * SR), 2)) + 1e-7
+ mev, mbd = ev.mean(1), bd.mean(1)
+ r = {'t0': round(t0, 3), 't1': round(t1, 3), 'dur_s': round(t1 - t0, 3), 'bed': [round(bed[0], 3), round(bed[1], 3)]}
+
+ # levels (K-weighted)
+ pre = _seg(x, max(0, bed[0] - 0.5), t1).mean(1)
+ kw = kweight(pre)
+ off = len(pre) - len(mev)
+ kb = kw[int(round((bed[0] - max(0, bed[0] - 0.5)) * SR)):][:len(mbd)]
+ ke = kw[off:]
+ bed_p = np.mean(kb ** 2) + 1e-14
+ win = int(0.1 * SR)
+ if len(ke) > win:
+ c = np.convolve(ke ** 2, np.ones(win) / win, 'valid')
+ ev_p = c.max()
+ else:
+ ev_p = np.mean(ke ** 2)
+ r['bed_lufs'] = round(-0.691 + 10 * np.log10(bed_p), 1)
+ r['ev_lufs'] = round(-0.691 + 10 * np.log10(ev_p + 1e-14), 1)
+ r['bed_silent'] = bool(r['bed_lufs'] < -60)
+ r['over_bed_db'] = round(r['ev_lufs'] - max(r['bed_lufs'], -70.0), 1) # a silent bed counts as -70
+ pe, pb = np.mean(mev ** 2), np.mean(mbd ** 2) + 1e-14
+ r['snr_db'] = round(10 * np.log10(max(pe - pb, 1e-14) / pb), 1)
+
+ # third-octave balance, bed-subtracted
+ f, Pe = _psd(mev)
+ # bed spectrum: average of bed chunks of the event's length (or the whole bed when shorter)
+ L = min(len(mbd), len(mev))
+ chunks = [mbd[i:i + L] for i in range(0, len(mbd) - L + 1, max(1, L // 2))] or [mbd]
+ Pb = np.mean([_psd(c, len(f) * 2 - 2)[1] for c in chunks], 0)
+ Be, Bb = _bands(f, Pe), _bands(f, Pb)
+ D = np.maximum(Be - Bb, 1e-14)
+ masked = (10 * np.log10(Be + 1e-14) - 10 * np.log10(Bb + 1e-14)) < 1.0
+ D[masked] = np.minimum(D[masked], Be[masked] * 0.05)
+ tot = D.sum() + 1e-14
+ evdb = 10 * np.log10(D / tot)
+ r['third_oct'] = {'centres': [round(c, 1) for c in CENTRES],
+ 'ev_db': [round(max(v, -60), 1) for v in evdb],
+ 'bed_db': [round(max(v, -60), 1) for v in 10 * np.log10(Bb / tot + 1e-14)],
+ 'excess_db': [round(v, 1) for v in 10 * np.log10(Be + 1e-14) - 10 * np.log10(Bb + 1e-14)],
+ 'masked': [bool(v) for v in masked]}
+ lc = np.log2(np.array(CENTRES))
+ k = (np.array(CENTRES) >= 100) & (np.array(CENTRES) <= 10000) & ~masked
+ if k.sum() >= 4:
+ r['tilt_db_oct'] = round(float(np.polyfit(lc[k] - lc[k].mean(), evdb[k], 1)[0]), 2)
+ else:
+ r['tilt_db_oct'] = None
+ sh = []
+ for lo, hi in REGIONS:
+ kk = (f >= lo) & (f < hi)
+ sh.append(round(10 * np.log10(max(Pe[kk].sum() - Pb[kk].sum(), 1e-14) / max(Pe.sum() - Pb.sum(), 1e-14)), 1))
+ r['shares'] = sh
+ # spectral centroid of the bed-subtracted spectrum
+ Dp = np.maximum(Pe - Pb, 0)
+ r['centroid_hz'] = round(float((f * Dp).sum() / (Dp.sum() + 1e-14)), 0)
+
+ # envelope (1 ms, bed-subtracted power)
+ e = 10 ** (_env_db(mev) / 10) - pb
+ e = np.maximum(e, pb * 1e-3)
+ edb = 10 * np.log10(e)
+ ip = int(np.argmax(edb))
+ pk = edb[ip]
+ i20 = int(np.argmax(edb[:ip + 1] >= pk - 20))
+ r['attack_ms'] = float(ip - i20)
+ amp = np.sqrt(e)
+ i10 = int(np.argmax(amp[:ip + 1] >= 0.1 * amp[ip]))
+ i90 = int(np.argmax(amp[:ip + 1] >= 0.9 * amp[ip]))
+ r['rise_ms'] = float(i90 - i10)
+ r['t_peak'] = round(t0 + ip / 1000, 4)
+ r['t_attack'] = round(t0 + i20 / 1000, 4)
+ r['peak_frac'] = round(ip / max(1, len(edb)), 3)
+ bedlvl = 10 * np.log10(pb)
+ # smoothed envelope for decay (10 ms)
+ es = np.convolve(e, np.ones(10) / 10, 'same')
+ esdb = 10 * np.log10(es + 1e-14)
+ after = esdb[ip:]
+ pk_s = esdb[ip]
+
+ def fall(db):
+ j = np.nonzero(after <= pk_s - db)[0]
+ return float(j[0]) if len(j) else None
+ r['t20_ms'], r['t40_ms'] = fall(20), fall(40)
+ r['peak_over_bed_db'] = round(float(min(pk_s - bedlvl, pk_s - 10 * np.log10(1e-7))), 1)
+ j20 = r['t20_ms']
+ if j20 and j20 >= 8:
+ seg = after[:int(j20) + 1]
+ tt = np.arange(len(seg)) / 1000
+ p1 = np.polyfit(tt, seg, 1)
+ r['decay_db_s'] = round(float(p1[0]), 1)
+ mid = seg[len(seg) // 2] - (seg[0] + seg[-1]) / 2
+ r['decay_shape'] = 'convex' if mid > 2.5 else ('concave' if mid < -2.5 else 'exp')
+ r['decay_mid_dev_db'] = round(float(mid), 1)
+ else:
+ r['decay_db_s'] = None
+ r['decay_shape'] = None
+ # rise shape (onset -> peak) for swells / whooshes: mid-point deviation from a straight dB ramp
+ if ip - i20 >= 20:
+ seg = esdb[i20:ip + 1]
+ mid = seg[len(seg) // 2] - (seg[0] + seg[-1]) / 2
+ r['rise_shape'] = 'convex' if mid > 2.5 else ('concave' if mid < -2.5 else 'exp')
+ r['rise_mid_dev_db'] = round(float(mid), 1)
+
+ # centroid track (20 ms frames, bed-subtracted)
+ Fm, n = _frames(mev, 20)
+ if len(Fm) >= 2:
+ w = np.hanning(n)
+ S = np.abs(np.fft.rfft(Fm * w, 2048)) ** 2
+ ff = np.fft.rfftfreq(2048, 1 / SR)
+ Bs = np.abs(np.fft.rfft(chunks[0][:n] * w if len(chunks[0]) >= n else np.zeros(n), 2048)) ** 2
+ if len(mbd) >= n:
+ Bf, _ = _frames(mbd, 20)
+ Bs = (np.abs(np.fft.rfft(Bf * w, 2048)) ** 2).mean(0)
+ Sd = np.maximum(S - Bs, 0)
+ en = Sd.sum(1)
+ ok = en >= en.max() * 0.01
+ cen = (Sd * ff).sum(1) / (en + 1e-14)
+ idx = np.nonzero(ok)[0]
+ tr = [(round(t0 + (i + 0.5) * 0.02, 3), round(float(cen[i]), 0)) for i in idx]
+ r['centroid'] = {'start': tr[0][1], 'peak': round(float(cen[int(np.argmax(en))]), 0), 'end': tr[-1][1],
+ 'track': tr}
+ if len(tr) >= 3 and tr[0][1] > 0 and tr[-1][1] > 0:
+ # robust: medians of first / last quarter of active frames
+ q = max(1, len(tr) // 4)
+ c0 = np.median([v for _, v in tr[:q]])
+ c1 = np.median([v for _, v in tr[-q:]])
+ r['centroid']['sweep_oct'] = round(float(np.log2(c1 / c0)), 2)
+ span = tr[-1][0] - tr[0][0]
+ r['centroid']['sweep_oct_s'] = round(float(np.log2(c1 / c0) / max(span, 0.02)), 2)
+ # rise-to-peak and peak-to-end sweeps
+ ipk = int(np.argmax([en[i] for i in idx]))
+ cp = np.median([v for _, v in tr[max(0, ipk - 1):ipk + 2]])
+ r['centroid']['to_peak_oct'] = round(float(np.log2(cp / c0)), 2)
+ r['centroid']['from_peak_oct'] = round(float(np.log2(c1 / cp)), 2)
+ # low f0 track (20-250 Hz peak) on 80 ms frames for sub content
+ F8, n8 = _frames(mev, 80)
+ if len(F8) >= 2:
+ S8 = np.abs(np.fft.rfft(F8 * np.hanning(n8), 16384)) ** 2
+ f8 = np.fft.rfftfreq(16384, 1 / SR)
+ kb = (f8 >= 20) & (f8 <= 250)
+ pk8 = f8[kb][np.argmax(S8[:, kb], 1)]
+ lv8 = 10 * np.log10(S8[:, kb].max(1) + 1e-14)
+ okk = lv8 >= lv8.max() - 25
+ ii = np.nonzero(okk)[0]
+ r['f0_track'] = {'track': [(round(t0 + (i + 0.5) * 0.08, 2), round(float(pk8[i]), 1)) for i in ii],
+ 'start': round(float(pk8[ii[0]]), 1), 'end': round(float(pk8[ii[-1]]), 1),
+ 'oct': round(float(np.log2(pk8[ii[-1]] / max(pk8[ii[0]], 1))), 2)}
+
+ # ridge: the dominant (bed-subtracted) peak frequency per 10 ms frame, 80 Hz - 16 kHz (tonal sweeps: zips, pops,
+ # stings, the tonal layer of a riser); frames within 20 dB of the loudest frame
+ Fr, nr = _frames(mev, 10)
+ if len(Fr) >= 3:
+ wr = np.hanning(nr)
+ Sr = np.abs(np.fft.rfft(Fr * wr, 8192)) ** 2
+ fr = np.fft.rfftfreq(8192, 1 / SR)
+ if len(mbd) >= nr:
+ Bfr, _ = _frames(mbd, 10)
+ Sr = np.maximum(Sr - (np.abs(np.fft.rfft(Bfr * wr, 8192)) ** 2).mean(0) * 1.5, 0)
+ kb = (fr >= 80) & (fr <= 16000)
+ pkf = fr[kb][np.argmax(Sr[:, kb], 1)]
+ pe_ = Sr[:, kb].max(1)
+ ok = pe_ >= pe_.max() * 0.01
+ ii = np.nonzero(ok)[0]
+ tr = [(round(t0 + (i + 0.5) * 0.01, 3), round(float(pkf[i]), 0)) for i in ii]
+ q = max(1, len(tr) // 5)
+ f0_, f1_ = float(np.median([v for _, v in tr[:q]])), float(np.median([v for _, v in tr[-q:]]))
+ r['ridge'] = {'start_hz': round(f0_, 0), 'end_hz': round(f1_, 0),
+ 'min_hz': round(float(min(v for _, v in tr)), 0), 'max_hz': round(float(max(v for _, v in tr)), 0),
+ 'peak_hz': round(float(pkf[int(np.argmax(pe_))]), 0),
+ 'sweep_oct': round(float(np.log2(max(f1_, 1) / max(f0_, 1))), 2), 'track': tr}
+ # amplitude modulation of the 1 ms envelope (stutter / gate / typing rate): strongest 4-60 Hz component
+ if len(edb) >= 200:
+ env = np.sqrt(e)
+ trend = np.convolve(env, np.ones(101) / 101, 'same')
+ mod = env - trend
+ Fm_ = np.abs(np.fft.rfft(mod * np.hanning(len(mod)), 1 << 15))
+ fm = np.fft.rfftfreq(1 << 15, 1 / 1000)
+ km = (fm >= 4) & (fm <= 60)
+ if km.any():
+ j = int(np.argmax(Fm_[km]))
+ r['am_rate_hz'] = round(float(fm[km][j]), 1)
+ r['am_depth'] = round(float(np.std(mod) / (np.mean(env) + 1e-12)), 2)
+
+ # stereo
+ Lc, Rc = ev[:, 0], ev[:, 1]
+ M, Sd_ = (Lc + Rc) / 2, (Lc - Rc) / 2
+ Mb, Sb = mbd, (bd[:, 0] - bd[:, 1]) / 2
+ pm = max(np.mean(M ** 2) - np.mean(Mb ** 2), 1e-14)
+ ps = max(np.mean(Sd_ ** 2) - np.mean(Sb ** 2), 1e-14)
+ r['stereo'] = {'side_mid_db': round(max(10 * np.log10(ps / pm), -40.0), 1),
+ 'side_mid_raw_db': round(10 * np.log10((np.mean(Sd_ ** 2) + 1e-14) / (np.mean(M ** 2) + 1e-14)), 1),
+ 'bed_side_mid_db': round(10 * np.log10((np.mean(Sb ** 2) + 1e-14) / (np.mean(Mb ** 2) + 1e-14)), 1),
+ 'corr': round(float(np.corrcoef(Lc, Rc)[0, 1]) if np.std(Lc) > 0 and np.std(Rc) > 0 else 1.0, 3)}
+ FL, _ = _frames(Lc, 20)
+ FR, _ = _frames(Rc, 20)
+ if len(FL):
+ el, er = (FL ** 2).mean(1), (FR ** 2).mean(1)
+ act = (el + er) >= (el + er).max() * 0.05
+ pan = 10 * np.log10((el[act] + 1e-14) / (er[act] + 1e-14))
+ r['stereo']['pan_db'] = {'min': round(float(pan.min()), 1), 'max': round(float(pan.max()), 1),
+ 'travel': round(float(pan.max() - pan.min()), 1),
+ 'start': round(float(pan[0]), 1), 'end': round(float(pan[-1]), 1)}
+ if cut is not None:
+ r['cut'] = round(cut, 3)
+ r['peak_vs_cut_ms'] = round((r['t_peak'] - cut) * 1000, 0)
+ r['attack_vs_cut_ms'] = round((r['t_attack'] - cut) * 1000, 0)
+ r['end_vs_cut_ms'] = round((t1 - cut) * 1000, 0)
+ return r
diff --git a/eval/forge/pro/run_timeline.py b/eval/forge/pro/run_timeline.py
new file mode 100644
index 0000000..dc13cf2
--- /dev/null
+++ b/eval/forge/pro/run_timeline.py
@@ -0,0 +1,29 @@
+"""earshot timeline (detail high) + sheet over each reference film: JSON, transcript and sheet PNG in out/refs_pro/_work.
+
+ EARSHOT_THREADS=2 python eval/forge/pro/run_timeline.py ref_4 ref_1
+"""
+import json
+import os
+import sys
+import time
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+REPO = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
+sys.path.insert(0, REPO)
+sys.path.insert(0, HERE)
+from videos import WORK, path # noqa: E402
+from earshot import api # noqa: E402
+from earshot.report import to_json # noqa: E402
+
+for ref in sys.argv[1:]:
+ t0 = time.time()
+ p = path(ref)
+ r = api.timeline(p, detail='high')
+ os.makedirs(f'{WORK}/tl', exist_ok=True)
+ with open(f'{WORK}/tl/{ref}.json', 'w', encoding='utf-8') as fh:
+ fh.write(to_json(r))
+ with open(f'{WORK}/tl/{ref}.txt', 'w', encoding='utf-8') as fh:
+ fh.write(r['text'])
+ t1 = time.time()
+ s = api.sheet(p, f'{WORK}/sheets/{ref}_full.png', detail='high', width=2400, tl=r)
+ print(ref, f'timeline {t1 - t0:.0f}s sheet {time.time() - t1:.0f}s', len(r['events']), 'events', flush=True)
diff --git a/eval/forge/pro/study.py b/eval/forge/pro/study.py
new file mode 100644
index 0000000..bb1569b
--- /dev/null
+++ b/eval/forge/pro/study.py
@@ -0,0 +1,252 @@
+"""Measure, export and summarise the curated pro motion-SFX events (eval/forge/pro/events.py).
+
+ python eval/forge/pro/study.py # measure all, export trims, manifest, registry, stats, sheets
+ python eval/forge/pro/study.py --no-export # measurements + stats only
+ python eval/forge/pro/study.py --sheets-only # only the per-category spectrogram crop sheets
+
+Outputs (local only: the films are third-party):
+ out/refs_pro/<category>/{forge,bench}/<ref>_<ms>.wav trims (trim + fade only, original gain, stereo 48 kHz 24-bit)
+ out/refs_pro/manifest.json every event: film id, times, category, cut, bed level, measurements, earshot evidence
+ out/refs_pro/registry.json earshot.forge.refsets format: {'version', 'categories': {cat: {forge, bench, note}}}
+ out/refs_pro/stats.json per category: count, medians / quartiles of the measured numbers
+ out/refs_pro/_work/cat/<category>.png spectrogram crops of the category's events (look at these)
+The split is by film: a film is 'forge' or 'bench' for every category (SPLIT below), so a forge tuned on the forge
+side is benchmarked on films it never heard.
+"""
+import argparse
+import json
+import os
+import sys
+
+import numpy as np
+import soundfile as sf
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from videos import OUT, VIDEOS, WORK, wav # noqa: E402
+from measure import measure # noqa: E402
+from events import EVENTS, SPLIT, NOTES # noqa: E402
+
+SR = 48000
+
+
+def load(ref, _c={}):
+ if ref not in _c:
+ x, sr = sf.read(wav(ref), dtype='float64', always_2d=True)
+ assert sr == SR
+ _c[ref] = x
+ return _c[ref]
+
+
+def tl(ref, _c={}):
+ if ref not in _c:
+ p = f'{WORK}/tl/{ref}.json'
+ _c[ref] = json.load(open(p, encoding='utf-8')) if os.path.exists(p) else None
+ return _c[ref]
+
+
+def evidence(ref, t0, t1):
+ r = tl(ref)
+ if not r:
+ return {}
+ evs = []
+ for e in r['events']:
+ if t0 - 0.02 <= e['t'] <= t1:
+ evs.append({'t': e['t'], 'kind': e.get('kind'), 'label': e.get('label'),
+ 'tag': (e.get('tags') or [{}])[0].get('tag'), 'prominence_db': e.get('prominence_db'),
+ 'bed_db': e.get('bed_db'), 'contrast_db': e.get('contrast_db'), 'band': e.get('band'),
+ 'exposed': e.get('exposed'), 'length_ms': e.get('length_ms')})
+ cuts = [c for c in (r.get('cuts') or []) if t0 - 0.5 <= c <= t1 + 0.5]
+ return {'timeline_events': evs[:12], 'cuts_near': cuts}
+
+
+def norm(e):
+ d = {'ref': e[0], 't0': e[1], 't1': e[2], 'cat': e[3], 'cut': e[4] if len(e) > 4 else None,
+ 'note': e[5] if len(e) > 5 else '', 'bed': e[6] if len(e) > 6 else None}
+ d['export'] = not d['note'].startswith('noexp')
+ return d
+
+
+def export(d, x, split):
+ pre = 0.005
+ a, b = max(0, int((d['t0'] - pre) * SR)), min(len(x), int(d['t1'] * SR))
+ y = x[a:b].copy()
+ fi = int(0.002 * SR)
+ fo = int(min(0.03 + 0.1 * (d['t1'] - d['t0']), 0.25) * SR)
+ fo = min(fo, len(y) // 3)
+ y[:fi] *= np.linspace(0, 1, fi)[:, None]
+ y[-fo:] *= np.linspace(1, 0, fo)[:, None] ** 2
+ folder = f"{OUT}/{d['cat']}/{split}"
+ os.makedirs(folder, exist_ok=True)
+ f = f"{folder}/{d['ref']}_{int(round(d['t0'] * 1000)):06d}.wav"
+ sf.write(f, y.astype(np.float32), SR, subtype='PCM_24')
+ return f, round(a / SR, 4), round(b / SR, 4), round(fo / SR, 3)
+
+
+NUMS = ['dur_s', 'over_bed_db', 'snr_db', 'peak_over_bed_db', 'bed_lufs', 'ev_lufs', 'attack_ms', 'rise_ms',
+ 'peak_frac', 't20_ms', 't40_ms', 'decay_db_s', 'tilt_db_oct', 'centroid_hz', 'peak_vs_cut_ms',
+ 'attack_vs_cut_ms', 'end_vs_cut_ms']
+
+
+def stats(rows):
+ out = {}
+ cats = sorted({r['cat'] for r in rows})
+ for c in cats:
+ rr = [r for r in rows if r['cat'] == c]
+ s = {'n': len(rr), 'films': sorted({r['ref'] for r in rr})}
+ for k in NUMS:
+ v = [r['m'].get(k) for r in rr if r['m'].get(k) is not None]
+ if v:
+ s[k] = {'med': round(float(np.median(v)), 2), 'q1': round(float(np.percentile(v, 25)), 2),
+ 'q3': round(float(np.percentile(v, 75)), 2), 'min': round(float(min(v)), 2),
+ 'max': round(float(max(v)), 2), 'n': len(v)}
+ for k in ('sweep_oct', 'to_peak_oct', 'from_peak_oct', 'start', 'peak', 'end'):
+ v = [r['m'].get('centroid', {}).get(k) for r in rr if r['m'].get('centroid', {}).get(k) is not None]
+ if v:
+ s['centroid_' + k] = {'med': round(float(np.median(v)), 2), 'q1': round(float(np.percentile(v, 25)), 2),
+ 'q3': round(float(np.percentile(v, 75)), 2), 'n': len(v)}
+ for k in ('side_mid_db', 'side_mid_raw_db', 'corr'):
+ v = [r['m']['stereo'].get(k) for r in rr]
+ s['stereo_' + k] = {'med': round(float(np.median(v)), 2), 'q1': round(float(np.percentile(v, 25)), 2),
+ 'q3': round(float(np.percentile(v, 75)), 2)}
+ v = [r['m']['stereo'].get('pan_db', {}).get('travel') for r in rr if r['m']['stereo'].get('pan_db')]
+ if v:
+ s['pan_travel_db'] = {'med': round(float(np.median(v)), 2), 'max': round(float(max(v)), 2)}
+ for k in ('start_hz', 'end_hz', 'min_hz', 'max_hz', 'peak_hz', 'sweep_oct'):
+ v = [r['m']['ridge'][k] for r in rr if r['m'].get('ridge')]
+ if v:
+ s['ridge_' + k] = {'med': round(float(np.median(v)), 2), 'min': round(float(min(v)), 2),
+ 'max': round(float(max(v)), 2), 'n': len(v)}
+ v = [r['m'].get('am_rate_hz') for r in rr if r['m'].get('am_rate_hz')]
+ if v:
+ s['am_rate_hz'] = {'med': round(float(np.median(v)), 1), 'min': min(v), 'max': max(v)}
+ f0 = [r['m']['f0_track'] for r in rr if r['m'].get('f0_track')]
+ if f0:
+ s['f0_start'] = round(float(np.median([q['start'] for q in f0])), 1)
+ s['f0_end'] = round(float(np.median([q['end'] for q in f0])), 1)
+ s['f0_oct'] = round(float(np.median([q['oct'] for q in f0])), 2)
+ # bed-subtracted 1/3-octave balance: median over events of each band (dB re total), unmasked bands only
+ ev = np.array([r['m']['third_oct']['ev_db'] for r in rr])
+ mk = np.array([r['m']['third_oct']['masked'] for r in rr])
+ med = []
+ for j in range(ev.shape[1]):
+ vv = ev[~mk[:, j], j]
+ med.append(round(float(np.median(vv)), 1) if len(vv) else None)
+ s['third_oct_med_db'] = med
+ s['third_oct_centres'] = rr[0]['m']['third_oct']['centres']
+ sh = np.array([r['m']['shares'] for r in rr])
+ s['shares_med_db'] = [round(float(v), 1) for v in np.median(sh, 0)]
+ shapes = [r['m'].get('decay_shape') for r in rr if r['m'].get('decay_shape')]
+ s['decay_shapes'] = {k: shapes.count(k) for k in sorted(set(shapes))}
+ rshapes = [r['m'].get('rise_shape') for r in rr if r['m'].get('rise_shape')]
+ s['rise_shapes'] = {k: rshapes.count(k) for k in sorted(set(rshapes))}
+ out[c] = s
+ return out
+
+
+def cat_sheets(rows, max_per=12):
+ import matplotlib
+ matplotlib.use('Agg')
+ import matplotlib.pyplot as plt
+ import viewer
+ os.makedirs(f'{WORK}/cat', exist_ok=True)
+ outs = []
+ for c in sorted({r['cat'] for r in rows}):
+ rr = [r for r in rows if r['cat'] == c][:max_per]
+ cols = 3
+ nrow = int(np.ceil(len(rr) / cols))
+ fig = plt.figure(figsize=(5.6 * cols, 3.3 * nrow), dpi=90)
+ gs = fig.add_gridspec(2 * nrow, cols, height_ratios=[3, 1.2] * nrow, hspace=0.3, wspace=0.18)
+ for i, r in enumerate(rr):
+ x = load(r['ref']).astype(np.float32)
+ cuts = (tl(r['ref']) or {}).get('cuts') or []
+ evs = (tl(r['ref']) or {}).get('events') or []
+ pad = max(0.15, 0.25 * (r['t1'] - r['t0']))
+ q, k = divmod(i, cols)
+ m = r['m']
+ lab = (f"{c} {r['t0']:.2f}-{r['t1']:.2f} +{m['over_bed_db']}dB atk {m['attack_ms']:.0f}ms "
+ f"sw {m.get('centroid', {}).get('sweep_oct', '-')}oct")
+ ax, ax2 = viewer.lane(fig, gs[2 * q, k], gs[2 * q + 1, k], x, r['t0'] - pad, r['t1'] + pad, cuts, evs,
+ title=f"{r['ref']} {lab}")
+ ax.axvline(r['t0'], color='w', lw=0.6, ls=':')
+ ax.axvline(r['t1'], color='w', lw=0.6, ls=':')
+ ax2.tick_params(labelsize=6)
+ out = f'{WORK}/cat/{c}.png'
+ fig.savefig(out, bbox_inches='tight')
+ plt.close(fig)
+ outs.append(out)
+ return outs
+
+
+def main():
+ ap = argparse.ArgumentParser()
+ ap.add_argument('--no-export', action='store_true')
+ ap.add_argument('--sheets-only', action='store_true')
+ ap.add_argument('--no-sheets', action='store_true')
+ ap.add_argument('--cats', nargs='*')
+ a = ap.parse_args()
+ rows = []
+ for e in EVENTS:
+ d = norm(e)
+ if a.cats and d['cat'] not in a.cats:
+ continue
+ x = load(d['ref'])
+ d['m'] = measure(x, d['t0'], d['t1'], bed=d['bed'], cut=d['cut'])
+ rows.append(d)
+ if a.sheets_only:
+ print('\n'.join(cat_sheets(rows)))
+ return
+ man = []
+ reg = {'version': 1, 'source': 'pro motion-design launch films (third-party, local only); see '
+ 'docs/motion-sfx-study.md', 'categories': {}}
+ if not a.no_export:
+ import shutil
+ for c in sorted({r['cat'] for r in rows}):
+ if os.path.isdir(f'{OUT}/{c}'):
+ shutil.rmtree(f'{OUT}/{c}')
+ for d in rows:
+ split = SPLIT[d['ref']]
+ ent = {'film': d['ref'], 'source_file': VIDEOS[d['ref']], 'category': d['cat'], 't0': d['t0'], 't1': d['t1'],
+ 'cut': d['cut'], 'split': split, 'note': d['note'], 'bed_lufs': d['m']['bed_lufs'],
+ 'over_bed_db': d['m']['over_bed_db'], 'snr_db': d['m']['snr_db'], 'measured': d['m'],
+ 'earshot': evidence(d['ref'], d['t0'], d['t1'])}
+ if not a.no_export and d['export']:
+ f, ta, tb, fo = export(d, load(d['ref']), split)
+ ent.update({'file': f, 'trim_s': [ta, tb], 'fade_in_s': 0.002, 'fade_out_s': fo, 'gain_db': 0.0})
+ c = reg['categories'].setdefault(d['cat'], {'forge': [], 'bench': [], 'note': NOTES.get(d['cat'], '')})
+ c[split].append(os.path.relpath(f, OUT).replace(chr(92), '/'))
+ man.append(ent)
+ st = stats(rows)
+ with open(f'{OUT}/stats.json', 'w', encoding='utf-8') as fh:
+ json.dump(st, fh, indent=1)
+ if not a.no_export:
+ with open(f'{OUT}/manifest.json', 'w', encoding='utf-8') as fh:
+ json.dump(man, fh, indent=1)
+ with open(f'{OUT}/registry.json', 'w', encoding='utf-8') as fh:
+ json.dump(reg, fh, indent=1)
+ # sanity: the split never leaks a film
+ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(HERE))))
+ from earshot.forge import refsets
+ srcs = {f"{OUT}/{p}": p.split('/')[-1].split('_')[0] + '_' + p.split('/')[-1].split('_')[1]
+ for cc in reg['categories'].values() for s in ('forge', 'bench') for p in cc[s]}
+ reg_abs = refsets.load(f'{OUT}/registry.json')
+ srcs = {}
+ for cc in reg_abs['categories'].values():
+ for s in ('forge', 'bench'):
+ for p in cc[s]:
+ srcs[p] = os.path.basename(p).rsplit('_', 1)[0]
+ bad = refsets.check_split(reg_abs, srcs)
+ print('split check:', bad or 'ok')
+ for c, s in st.items():
+ def g(k, f='med'):
+ return s.get(k, {}).get(f, '-') if isinstance(s.get(k), dict) else '-'
+ print(f"{c:12s} n={s['n']:2d} films={','.join(f[4:] for f in s['films'])} dur {g('dur_s')} "
+ f"over_bed {g('over_bed_db')} atk {g('attack_ms')} t20 {g('t20_ms')} tilt {g('tilt_db_oct')} "
+ f"cen {g('centroid_hz')} sweep {g('centroid_sweep_oct')} S/M {g('stereo_side_mid_db')} "
+ f"pk-cut {g('peak_vs_cut_ms')}")
+ if not a.no_sheets:
+ print('\n'.join(cat_sheets(rows)))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/eval/forge/pro/videos.py b/eval/forge/pro/videos.py
new file mode 100644
index 0000000..3ac9e3f
--- /dev/null
+++ b/eval/forge/pro/videos.py
@@ -0,0 +1,31 @@
+"""The reference films of the pro motion-SFX study (third-party, local only: never committed or redistributed).
+
+ref_1..ref_8 are anonymous ids. The mapping to the local video files lives only in the local data folder
+(out/refs_pro/films_map.json: {"src": folder, "films": {"ref_1": "file.mp4", ...}}), so nothing committed names a film.
+"""
+import json
+import os
+
+OUT = os.environ.get('EARSHOT_REFS_PRO', 'E:/earshot/out/refs_pro').replace(chr(92), '/')
+WORK = OUT + '/_work'
+_MAP = OUT + '/films_map.json'
+
+
+def _load():
+ if not os.path.exists(_MAP):
+ return {'src': '', 'films': {}}
+ with open(_MAP, encoding='utf-8') as fh:
+ return json.load(fh)
+
+
+_M = _load()
+SRC = _M.get('src', '')
+VIDEOS = _M.get('films', {})
+
+
+def path(ref):
+ return os.path.join(SRC, VIDEOS[ref]).replace(chr(92), '/')
+
+
+def wav(ref):
+ return f'{WORK}/audio/{ref}.wav'
diff --git a/eval/forge/pro/viewer.py b/eval/forge/pro/viewer.py
new file mode 100644
index 0000000..f3ad940
--- /dev/null
+++ b/eval/forge/pro/viewer.py
@@ -0,0 +1,193 @@
+"""Pictures for the pro motion-SFX study: paged overviews (8 s rows) and zoomed crops of single events.
+
+ python eval/forge/pro/viewer.py overview ref_1 # out/refs_pro/_work/view/ref_1_p1.png ...
+ python eval/forge/pro/viewer.py crops ref_1 6.07 10.93 # out/refs_pro/_work/view/ref_1_crops.png
+
+Each lane: log-frequency spectrogram (mid = (L+R)/2, 30 Hz - 20 kHz, 2048-pt FFT, 5.3 ms hop), picture cuts as cyan
+dashed lines, earshot timeline events as ticks (red = >= 12 dB over a running bed), then band levels (sub < 120 Hz,
+mid 120 Hz - 2 kHz, high > 4 kHz, dB) and the side/mid ratio (dB - 40, stereo width) underneath.
+"""
+import json
+import os
+import sys
+
+import matplotlib
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt # noqa: E402
+import numpy as np # noqa: E402
+import soundfile as sf # noqa: E402
+from scipy import signal # noqa: E402
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from videos import WORK, wav # noqa: E402
+
+SR = 48000
+NFFT, HOP = 2048, 256
+FMIN, FMAX, NROWS = 30.0, 20000.0, 200
+
+
+def load(ref):
+ x, sr = sf.read(wav(ref), dtype='float32', always_2d=True)
+ assert sr == SR
+ return x
+
+
+def tl(ref):
+ p = f'{WORK}/tl/{ref}.json'
+ if os.path.exists(p):
+ with open(p, encoding='utf-8') as fh:
+ return json.load(fh)
+ return None
+
+
+def cuts_events(ref):
+ r = tl(ref)
+ if r is None:
+ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(HERE))))
+ from earshot import video
+ from videos import path
+ return video.cuts(path(ref)), []
+ return r.get('cuts') or [], r.get('events') or []
+
+
+def logspec(m, t0, t1):
+ a, b = max(0, int(t0 * SR) - NFFT // 2), min(len(m), int(t1 * SR) + NFFT // 2)
+ seg = m[a:b]
+ f, t, Z = signal.stft(seg, SR, nperseg=NFFT, noverlap=NFFT - HOP, boundary=None, padded=False)
+ P = np.abs(Z) ** 2
+ edges = np.geomspace(FMIN, FMAX, NROWS + 1)
+ rows = []
+ for lo, hi in zip(edges[:-1], edges[1:]):
+ k = (f >= lo) & (f < hi)
+ if not k.any():
+ rows.append(P[np.argmin(np.abs(f - np.sqrt(lo * hi)))])
+ else:
+ rows.append(P[k].mean(0))
+ S = 10 * np.log10(np.array(rows) + 1e-12)
+ tt = (a + NFFT // 2 + t * SR - NFFT // 2) / SR
+ return tt, edges, S
+
+
+def band_db(m, t0, t1, lo, hi, win=0.02):
+ a, b = max(0, int(t0 * SR)), min(len(m), int(t1 * SR))
+ seg = m[a:b]
+ if lo <= 0:
+ sos = signal.butter(4, hi, 'lowpass', fs=SR, output='sos')
+ elif hi >= SR / 2:
+ sos = signal.butter(4, lo, 'highpass', fs=SR, output='sos')
+ else:
+ sos = signal.butter(4, [lo, hi], 'bandpass', fs=SR, output='sos')
+ y = signal.sosfiltfilt(sos, seg)
+ n = int(win * SR)
+ k = len(y) // n
+ e = 10 * np.log10((y[:k * n].reshape(k, n) ** 2).mean(1) + 1e-12)
+ return a / SR + (np.arange(k) + 0.5) * win, e
+
+
+def side_mid(x, t0, t1, win=0.02):
+ a, b = max(0, int(t0 * SR)), min(len(x), int(t1 * SR))
+ L, R = x[a:b, 0], x[a:b, 1]
+ M, S = (L + R) / 2, (L - R) / 2
+ n = int(win * SR)
+ k = len(M) // n
+ em = (M[:k * n].reshape(k, n) ** 2).mean(1)
+ es = (S[:k * n].reshape(k, n) ** 2).mean(1)
+ return a / SR + (np.arange(k) + 0.5) * win, 10 * np.log10((es + 1e-12) / (em + 1e-12))
+
+
+def lane(fig, gs_spec, gs_env, x, t0, t1, cuts, events, title=None, vmax=None):
+ m = x.mean(1)
+ tt, edges, S = logspec(m, t0, t1)
+ ax = fig.add_subplot(gs_spec)
+ vmax = vmax if vmax is not None else np.percentile(S, 99.7)
+ ax.pcolormesh(tt, np.sqrt(edges[:-1] * edges[1:]), S, shading='nearest', vmin=vmax - 75, vmax=vmax, cmap='magma', rasterized=True)
+ ax.set_yscale('log')
+ ax.set_ylim(FMIN, FMAX)
+ ax.set_yticks([50, 100, 200, 500, 1000, 2000, 5000, 10000])
+ ax.set_yticklabels(['50', '100', '200', '500', '1k', '2k', '5k', '10k'], fontsize=7)
+ ax.minorticks_off()
+ ax.set_xlim(t0, t1)
+ ax.tick_params(labelbottom=False, labelsize=7)
+ for c in cuts:
+ if t0 <= c <= t1:
+ ax.axvline(c, color='#00e5ff', ls='--', lw=1.0)
+ for e in events:
+ if t0 <= e['t'] <= t1:
+ strong = e.get('prominence_db', 0) >= 12 and e.get('bed_db', -80) > -60
+ ax.plot([e['t']], [FMAX * 0.8], marker='v', ms=4, color='#ff3030' if strong else '#bbbbbb')
+ if title:
+ ax.set_title(title, fontsize=8, loc='left')
+ ax2 = fig.add_subplot(gs_env, sharex=ax)
+ for lo, hi, col, nm in ((0, 120, '#1f77b4', 'sub'), (120, 2000, '#2ca02c', 'mid'), (4000, 24000, '#d62728', 'hi')):
+ tb, eb = band_db(m, t0, t1, lo, hi)
+ ax2.plot(tb, eb, color=col, lw=0.8, label=nm)
+ ts, es = side_mid(x, t0, t1)
+ ax2.plot(ts, es - 40, color='#9467bd', lw=0.6, label='S/M-40')
+ ax2.set_ylim(-95, 0)
+ ax2.grid(alpha=0.3)
+ ax2.tick_params(labelsize=7)
+ for c in cuts:
+ if t0 <= c <= t1:
+ ax2.axvline(c, color='#00a6d6', ls='--', lw=0.8)
+ return ax, ax2
+
+
+def overview(ref, row_s=8.0, rows_per_page=6):
+ x = load(ref)
+ dur = len(x) / SR
+ cuts, events = cuts_events(ref)
+ vmax = np.percentile(logspec(x.mean(1), 0, dur)[2], 99.7)
+ n_rows = int(np.ceil(dur / row_s))
+ outs = []
+ os.makedirs(f'{WORK}/view', exist_ok=True)
+ for p0 in range(0, n_rows, rows_per_page):
+ rr = range(p0, min(n_rows, p0 + rows_per_page))
+ fig = plt.figure(figsize=(16, 3.0 * len(rr)), dpi=100)
+ gs = fig.add_gridspec(3 * len(rr), 1, height_ratios=[3, 1.1, 0.35] * len(rr), hspace=0.08)
+ for i, r in enumerate(rr):
+ t0 = r * row_s
+ ax, ax2 = lane(fig, gs[3 * i], gs[3 * i + 1], x, t0, t0 + row_s, cuts, events, vmax=vmax,
+ title=f'{ref} {t0:.0f}-{t0 + row_s:.0f} s')
+ ticks = np.arange(t0, t0 + row_s + 1e-6, 0.25)
+ ax2.set_xticks(ticks)
+ ax2.set_xticklabels([f'{v:.0f}' if abs(v - round(v)) < 1e-6 else ('.5' if abs(v % 1 - 0.5) < 1e-6 else '')
+ for v in ticks], fontsize=7)
+ if i == 0:
+ ax2.legend(fontsize=6, ncol=4, loc='lower right')
+ out = f'{WORK}/view/{ref}_p{p0 // rows_per_page + 1}.png'
+ fig.savefig(out, bbox_inches='tight')
+ plt.close(fig)
+ outs.append(out)
+ return outs
+
+
+def crops(ref, specs, cols=3, out=None, half=1.0):
+ """specs: [(t_center, half_width or None, label)]"""
+ x = load(ref)
+ cuts, events = cuts_events(ref)
+ n = len(specs)
+ rows = int(np.ceil(n / cols))
+ fig = plt.figure(figsize=(5.6 * cols, 3.3 * rows), dpi=100)
+ gs = fig.add_gridspec(2 * rows, cols, height_ratios=[3, 1.2] * rows, hspace=0.25, wspace=0.18)
+ vmax = np.percentile(logspec(x.mean(1), 0, len(x) / SR)[2], 99.7)
+ for i, (tc, hw, lab) in enumerate(specs):
+ hw = hw or half
+ r, c = divmod(i, cols)
+ ax, ax2 = lane(fig, gs[2 * r, c], gs[2 * r + 1, c], x, tc - hw, tc + hw, cuts, events, vmax=vmax,
+ title=f'{ref} {tc:.2f}s {lab}')
+ ax2.tick_params(labelsize=6)
+ out = out or f'{WORK}/view/{ref}_crops.png'
+ os.makedirs(os.path.dirname(out), exist_ok=True)
+ fig.savefig(out, bbox_inches='tight')
+ plt.close(fig)
+ return out
+
+
+if __name__ == '__main__':
+ cmd, ref = sys.argv[1], sys.argv[2]
+ if cmd == 'overview':
+ for r in sys.argv[2:]:
+ print(overview(r), flush=True)
+ else:
+ print(crops(ref, [(float(a), None, '') for a in sys.argv[3:]]))