Skip to content

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

Bank and kits: apex holds through the fit to dur, kit check matches kit render, measured click pitch, silence audit

Leonxlnxb74046d0edef
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0fce3f..42e5850 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -60,7 +60,35 @@ model-free audit, and film kits. Reference: [docs/SFX.md](docs/SFX.md).
click and snap; crisp tick, light touch, text, click, snap, key and space bar; minimal light touch, text and snap
(16 role changes). A changed role keeps its loudness (`level_db` moved by the measured difference at the same
peak). Every note now says what the sound is and what was measured; no note cites a listening test. All takes of
- the three presets pass `earshot kit check` (57, 59 and 58 takes).
+ the three presets pass `earshot kit check` (64, 64 and 63 takes).
+- **The presets' bell spans two octaves of one pentatonic** (calm, crisp: kalimba G4-E6; minimal: the ding A5-G7; 10
+ notes each), so a climbing progress motif has a rung for every step; calm's tonal text holds the five pentatonic
+ degrees of one octave (C5 D5 E5 G5 A5), so a chain of fragments can step through the chord's tones. crisp and
+ minimal keep an untuned soft tap for text.
+
+### Fixed (review before release)
+
+- **apex with a short tail**: the fade that fits a whoosh to `dur` covered an apex 0.03-0.1 s before the end, so the
+ delivered peak came 8-189 ms early while `edits['apex']` (measured before that fit) said ok. The fade now starts at
+ least 5 ms after the apex, candidates are ranked on apex plus tail error, the peak is placed in whole 1 ms steps of
+ its measure, and `edits['apex']` is measured on the delivered file: 59 whoosh-family targets with 0.1-0.12 s tails
+ land within 2.5 ms.
+- **`kit check` refuses what `kit render` cannot use**, with the same checks (`knobs.validate`, `bank.level`): a null
+ or non-numeric `level_db`, `max_s` under 0.01 s (a silent take), `peak_db` / `weight` over 0 dBFS, knob values and
+ pitches the sound cannot take, a bad `sr`, and take files that would collide (two spellings of one pitch, or names
+ that differ only in case). Pitch labels are canonical (`C#5`, `Db5`, 554.37 Hz -> `Cs5`).
+- `knobs.midi` accepts `s` sharps (`Cs5`), the spelling of take file names and of cinetic's kit.py.
+- The audit flags **silence** (`silent`: a peak under -60 dBFS or less than 5 ms within 40 dB of it).
+- `bank.render` / `earshot sfx render` refuse a peak over 0 dBFS and sample rates other than 44100 / 48000 / 88200 /
+ 96000 (the CLI wrote clipped WAVs).
+- **Click and toggle pitch**: their `pitch` parameter is the tink centre, not the partial heard (click/soft +291
+ cents), so `--pitch C7` landed 362 cents off with no warning. Their note is now the measured partial (`meta.pitch_hz`
+ in the bank; no pitch knob where there is no clear partial), a target is landed by measurement, every measured pitch
+ edit reports `ok` (within 50 cents), and a miss adds a `pitch_off` warning to the take's checks.
+- `EARSHOT_BANK`: the docstring gives `os.pathsep` as the separator, and a missing or unreadable file is a readable
+ error naming it instead of a traceback.
+- The README and docs/SFX.md agree on the blind test: no v2 score is published; the README's test is the v1 one (one
+ listener, the author, 15 trials).
## 0.2.1 - 2026-10-17
diff --git a/README.md b/README.md
index 927c8dd..305fa5e 100644
--- a/README.md
+++ b/README.md
@@ -111,7 +111,7 @@ balance is closer in 3 of those 5 (key press 8.2 -> 7.4 dB, fast whoosh 8.6 -> 6
34, the made balance is at least as close to the held-out recordings as a second set of real recordings in 18 of the
21 categories that have a number, and every final re-renders from its `report.json` (`earshot forge --check`). The
model checks that v1 had saturated fell. A clean blind-test kit for the v2 sounds is `eval/forge/blind_v2.py`; no v2
-score is published yet. What changed, every number, and what is still weak: [docs/FORGE_V2.md](docs/FORGE_V2.md).
+score is published yet (docs/SFX.md says the same), so the blind test below is the v1 one. What changed, every number, and what is still weak: [docs/FORGE_V2.md](docs/FORGE_V2.md).
The reference recordings are licensed and not in this repo, so `--refset` needs a local registry: bring your own refs
with `--refs DIR`, or lay them out as described in `earshot/forge/refsets.py`. Without refs the critic runs in
diff --git a/docs/FORGE_V2.md b/docs/FORGE_V2.md
index 6922b97..61c6c83 100644
--- a/docs/FORGE_V2.md
+++ b/docs/FORGE_V2.md
@@ -251,7 +251,9 @@ Weakest:
1. **Listen.** `out/showcase/gallery_embedded.html` for the whole set; the blind test (`out/showcase/blind_v2/`,
20 trials, chance = 10, 15 or more right has p = 0.021) for the deciding call.
- Update the README's "Blind test" paragraph (it describes the v1 test: 8 of 15) with the v2 result.
+ When a v2 result exists, publish it in the README's "Blind test" paragraph and in docs/SFX.md "Limits" together,
+ with the number of listeners and trials (today both say that no v2 score is published; the README's paragraph is
+ the v1 test, 8 of 15, one listener).
2. **No media, no names.** `git ls-files | grep -iE '\.(wav|flac|mp3|ogg|m4a|mp4)$'` returns nothing (checked
12:10); the pro films appear only as ref_1..ref_8 (the map is `out/refs_pro/films_map.json`, local; at 12:10 no
tracked file named a film file or its folder).
diff --git a/docs/SFX.md b/docs/SFX.md
index 681b856..b95cb50 100644
--- a/docs/SFX.md
+++ b/docs/SFX.md
@@ -34,7 +34,8 @@ today. `earshot doctor` reports the version and the counts.
| `pluck.json` | `pluck1` | 3 | the tuned kalimba voices (`pluck/kalimba`, `pluck/kalimba_soft`, `pluck/kalimba_ring`) |
`bank.VERSION` joins the file versions (`forge_v2r6+fit1+pluck1`); extra bank files load from `EARSHOT_BANK` (paths
-joined by the OS path separator). Ids are `<category>/<member>`: the category is the public name (a user never needs the
+joined by the OS path separator, `os.pathsep`: `;` on Windows, `:` elsewhere; a missing or unreadable file is an error
+that names it). Ids are `<category>/<member>`: the category is the public name (a user never needs the
recipe module behind it: `typing_key` renders with `recipes/keypress.py`, `pro_pop` with `pop.render_v2`,
`pro_typing_run` with `typing.render_run`).
@@ -84,7 +85,7 @@ bit-exactly.
## Knobs: dur, apex, pitch, level
`bank.render(id, seed=None, dur=None, apex=None, pitch=None, peak_db=-1.0, sr=48000, weight=None)`;
-`earshot sfx render ID -o out.wav [--seed N] [--dur S] [--apex S] [--pitch NOTE|HZ] [--peak DB] [--weight W]`.
+`earshot sfx render ID -o out.wav [--seed N] [--dur S] [--apex S] [--pitch NOTE|HZ] [--peak DB] [--weight W] [--sr R]`.
Knobs edit the recipe's own parameters (`earshot/forge/knobs.py`); nothing is resampled or time-stretched.
`meta['edits']` reports what each knob did and how close it landed.
@@ -95,24 +96,29 @@ Knobs edit the recipe's own parameters (`earshot/forge/knobs.py`); nothing is re
shimmers, zips, glitches, typing runs, pro_logo_sting, the UI sounds' end gate) scale that key, render, measure and
correct along a secant through the renders so far (at most 2 corrections, keeping the closest); the rest (impact,
toggle, typing_key, logo_sting, pluck) keep their sound as it is. Then every dur lands exactly: a longer file is faded
- out to the length (raised cosine over a quarter of it, 10-150 ms), a shorter one padded with silence. A riser's
+ out to the length (raised cosine over a quarter of it, 10-150 ms; with apex as well the fade starts at least 5 ms
+ after the apex, shortening to as little as 2 ms), a shorter one padded with silence. A riser's
length is exact by construction (`length` 1.0 -> a 1.000 s file that stops on its loudest 5 ms).
- **apex** (seconds to the loudest 5 ms, the whoosh family only): the pass engine's peak is analytic,
`tp = rise * (|start_db| / 30) ** (1 / rise_k)`; rise is solved for the target, measured, corrected up to twice,
then the closest render's peak is placed on the target by trimming the quiet approach (a head at least 20 dB under
- the peak, with a 3 ms fade-in) or padding silence before it. Measured: the closed form lands within about 12 ms on
+ the peak, with a 3 ms fade-in) or padding silence before it, in whole 1 ms steps of the peak measure (a shift off
+ that grid can re-read a fluttering pass's near-equal maxima, 0.2 dB and 15 ms apart on whoosh_big/swell). With dur
+ as well, the candidates are ranked on apex error plus the error of the tail after it, and the apex is measured again
+ on the file after its fit to dur, so `edits['apex']` describes the delivered file. Measured: the closed form lands within about 12 ms on
the fast family, but a broad fluttering pass's 5 ms peak moves non-monotonically with rise (whoosh_big and
pro_whoosh_big swell: up to 50 ms for a 10 % change), so the search alone cannot promise 5 ms; with the placement
- every tested target lands within 2.5 ms (`edits['apex']`: `search_err_ms`, `fit`, `err_ms`, `ok`). Combine with dur
+ every tested target lands within 2.5 ms, also a whoosh peaking 0.03-0.1 s before its end (59 whoosh-family
+ targets, tails 0.1-0.12 s; `edits['apex']`: `search_err_ms`, `fit`, `measured`, `err_ms`, `ok`). Combine with dur
for a move: `--dur 0.8 --apex 0.32` = a 0.8 s file whose loudest moment is 0.32 s in.
-- **pitch** (`'C5'`, `'Eb6'`, `'F#4'`, `440`, `'440hz'`): the note goes into the recipe's pitch parameter and the
- parameters of the same body move by the same ratio:
+- **pitch** (`'C5'`, `'Eb6'`, `'F#4'` or `'Fs4'`, `440`, `'440hz'`): the note goes into the recipe's pitch parameter
+ and the parameters of the same body move by the same ratio:
| category | parameter (co-scaled) | range |
|---|---|---|
| pluck | f0 | 130-2100 Hz |
| notify / pro_notify | f0 (the head fundamental) | 220-3200 / 600-3200 Hz |
- | click, pro_click, toggle | pitch (the tink partials) | 1.2-9.5 kHz / 1.6-8 kHz |
+ | click, pro_click, toggle | pitch (the tink centre), landed on the heard partial (below) | the parameter's 1.2-9.5 kHz / 1.6-8 kHz, moved to the heard partial |
| hover_tick, pro_hover_tick | ping_f (tick_f), only members whose ping is on | 3-15 kHz |
| tap, pro_tap, pro_pop_in | body_f (knock_f, glass_f) | 70-220 Hz |
| pop / pro_pop | f0 (f_hi, f_lo, f_blip / + n_f0, n_f1) | 400-3500 / 280-1400 Hz |
@@ -126,10 +132,18 @@ Knobs edit the recipe's own parameters (`earshot/forge/knobs.py`); nothing is re
Noise sounds are refused with the reason (whoosh_fast, whoosh_big, swish, swipe, glitch, pro_glitch, typing_key,
pro_typing_key, pro_typing_run), as are targets outside the range and members whose tonal layer is off. The render is
- measured: `edits['pitch']['measured_hz']` / `cents_off` (pluck E5, notify G5, pro_sub_drop G1: 0 cents; a tap's body
- is a damped thump, within about 60 cents).
-- **level**: `peak_db` sets the sample peak (-1 dBFS by default); `weight` scales it by 6 dB per doubling (0.5 = 6 dB
- down) and refuses a level over 0 dBFS. Loudness inside a family was matched in the forge (`render_final()` keeps
+ measured: `edits['pitch']['measured_hz']` / `cents_off` / `ok` (within 50 cents; pluck E5, notify G5,
+ pro_sub_drop G1: 0 cents; a tap's body is a damped thump, within about 60 cents). A take whose note missed carries a
+ `pitch_off` warning in its checks, so a kit re-rolls or reports it; risers and impacts are not measured (`ok` null).
+ Clicks and toggles: their `pitch` parameter is the centre of the tink partials and noise band, not the partial you
+ hear (click/soft: 2454 Hz, heard 2903 Hz, +291 cents). Their note is the heard partial, measured when the bank was
+ built (`meta.pitch_hz`, shown by `sfx list`; null for click/thock and toggle/micro, which have no clear partial and
+ refuse a pitch), and a target is landed by measurement: the parameter moves by target / heard, the render is
+ measured and corrected at most twice. pro_click members land within a few cents; some click and toggle members do
+ not reach every note, and then say so (`ok` false, `pitch_off`).
+- **level**: `peak_db` sets the sample peak (-1 dBFS by default, 0 at most: a level over 0 dBFS is refused, it
+ would clip); `weight` scales it by 6 dB per doubling (0.5 = 6 dB down), with the same limit. `sr` is 48000 or one
+ of 44100 / 88200 / 96000 (the finished take resampled), as in a kit. Loudness inside a family was matched in the forge (`render_final()` keeps
that palette gain); a kit's `level_db` carries the mix level per role.
## The audit: `sfx check`
@@ -144,10 +158,12 @@ render runs it (`meta['checks']`). Warnings make `ok` false; notes are informati
| dc | an offset above -40 dB re peak | `polish.dc` |
| ring | a metallic comb in the tail (z > 15) | `polish.ring` |
| truncated | a tail cut while still decaying, above -45 dB; a note for the categories whose stop is the design (riser, pro_riser, pro_zip, glitch, pro_glitch, pro_impact) and for any sound that ends on its loudest moment | `polish.truncated` |
+| silent | nothing to hear: a sample peak under -60 dBFS, or less than 5 ms within 40 dB of the peak (the shortest bank sound holds 9 ms): digital silence, or a take faded to nothing | `sfx.live_ms` |
| silence | digital silence inside the sound (a note for glitches) | `polish.silence` |
| tail | the tail rises again by more than 6 dB (a note: a roll, a second event, a double member) | `polish.tail` |
| rising_glide | a tonal sound whose pitch climbs more than 4 semitones over at least 50 ms: the rising "synth whip" | `sfx.rising_glide` |
| stacked, pre_swell | for a hit (role hit / land): two separate attacks, or more than 100 ms of build before the hit | `sfx.layers` |
+| pitch_off | a render with a pitch knob whose measured note is more than 50 cents off (bank renders and kit takes) | `knobs.pitch_warning` |
The glide detector tracks the strongest partial in 21 ms frames every 5 ms where it holds at least half of the frame's
80 Hz-10 kHz energy within +-3 semitones (a tone, also a fast smeared sweep; a noise band does not), splits the track
@@ -188,16 +204,17 @@ text fragment resolving). Other role names are allowed; a renderer must know the
| `sound` | a bank id |
| `takes` | takes per role (default 1, at most 32); take k renders on `seed + k - 1` |
| `seed` | default: the sound's own, so take 1 is the delivered final |
-| `edits` | knobs for every take: `dur`, `apex`, `pitch`, `peak_db` (default -1), `weight` |
-| `pitches` | one set of takes per note (or Hz) |
+| `edits` | knobs for every take: `dur`, `apex`, `pitch`, `peak_db` (default -1, at most 0), `weight` |
+| `pitches` | one set of takes per note (or Hz); each pitch once (`C#5`, `Db5`, `Cs5` and 554.37 are one pitch) |
| `align` | the sync point a mixer puts on the cue: `onset`, `peak` (whoosh apexes), `end` (risers, swells); default per role |
-| `max_s` | a take longer than this is faded out to it |
-| `level_db` | the role's mix level relative to a take at its peak (for the mixer; the audition applies it) |
+| `max_s` | a take longer than this is faded out to it (0.01 s or more) |
+| `level_db` | the role's mix level relative to a take at its peak, a number (for the mixer; the audition applies it) |
| `note` | why this sound |
| `null` | the role is not sounded: a renderer skips its cues |
`earshot kit render audio/kit.json --out audio/kit` writes 24-bit takes (`hit_1.wav`, `tick-crisp_2.wav`,
-`bell_C5.wav`, `text_Cs5_2.wav`) and `kit.lock.json`:
+`bell_C5.wav`, `text_Cs5_2.wav`; one canonical label per pitch, so `Db5` is `Cs5` and 523.25 Hz is `C5`) and
+`kit.lock.json`:
```json
{"kit": 1, "earshot": "0.3.0", "bank": "forge_v2r6+fit1+pluck1", "sr": 48000, "name": "calm",
@@ -210,8 +227,12 @@ text fragment resolving). Other role names are allowed; a renderer must know the
- **Deterministic.** The same kit renders the same takes. A take that fails the audit is rendered again on
`seed + 1000 j` (up to 3 times) and the first clean one kept, as a sound designer discards a bad take; the lock then
- names `seed` and `planned_seed`. On the three presets 4 of 174 takes needed it (three key takes and a pitched ding,
+ names `seed` and `planned_seed`. On the three presets 4 of 191 takes needed it (three key takes and a pitched ding,
all forge members; no fitted sound); every preset take is clean.
+- **Validated like a render.** `kit check` refuses what `kit render` cannot use, with the same checks: knob values
+ and ranges (a whoosh-only apex, a pitch the sound cannot take, `dur` 0.01-60 s), `peak_db` / `weight` over 0 dBFS,
+ `max_s` under 0.01 s, a `level_db` that is no number, an unknown sample rate, and two takes that would share a file
+ (compared without regard to case, as on Windows and macOS file systems).
- **Cached.** A take whose key (bank entry, seed, pitch, edits, max_s, sr, bank version, earshot version) and file
hash match the existing lock is kept; changed roles re-render; files the new kit no longer names are removed (only
files the old lock listed); `--force` renders everything.
@@ -257,8 +278,8 @@ were chosen:
| key / .space / .return | typing_key/thock / fit/key.space/thock_space / typing_key/deep | fit/key/medium / fit/key.space/thock_space / typing_key/clicky | pro_typing_key glass / tick / double |
| click / click.confirm | fit/click/floss_lid / pluck/kalimba_soft C6 | fit/click/floss_lid / pro_notify/ding_2045 | pro_click/soft / pro_notify/ding_1822 |
| snap | fit/snap/switch_flip | fit/snap/switch_flip | fit/snap/switch_flip |
-| bell | pluck/kalimba C D E G A (octave 5) | pluck/kalimba C D E G A | pro_notify/ding_1822 F G A C D (octaves 6-7) |
-| text | pluck/kalimba_soft C5 E5 G5 | fit/land.light/finger_phone | fit/land.light/finger_phone |
+| bell | pluck/kalimba, C pentatonic G4-E6 (10 notes) | pluck/kalimba, C pentatonic G4-E6 | pro_notify/ding_1822, F pentatonic A5-G7 (10 notes) |
+| text | pluck/kalimba_soft C5 D5 E5 G5 A5 | fit/land.light/finger_phone (untuned) | fit/land.light/finger_phone (untuned) |
| riser / swell / suck | off | off | off |
The replacements, measured (match z / forced choice against the synth-blip descriptions / realness; `_compare` of
@@ -276,7 +297,10 @@ the fit run, the forge members at their own seed):
| snap ('a toggle switch click') | pro_pop_in/knock +0.61 / 0.27 / 0.08; toggle/latch +2.04 / 0.97 / 0.50 | switch_flip +2.24 / 1.00 / 0.97 | calm, crisp, minimal |
| text (a soft touch for a resolving fragment) | pro_tap/soft, pro_tap/finger (realness 0.16-0.25) | finger_phone (tagged 'a soft UI button tap', realness 0.89) | crisp, minimal |
-Set `edits.pitch` on `hit` (calm) and `drop` (crisp, minimal) to the film's root.
+Set `edits.pitch` on `hit` (calm) and `drop` (crisp, minimal) to the film's root. The bell spans two octaves of
+one pentatonic so a climbing progress motif finds a rung for each step; a tonal text role holds the five pentatonic
+degrees of one octave, so a chain of fragments can step through whichever of the chord's tones the takes hold. crisp
+and minimal resolve text on an untuned soft tap (a new take per fragment), which never clashes with a note.
## Python and MCP
@@ -375,7 +399,7 @@ Measured on the development laptop (AMD Ryzen 7 260, 2 threads, while other jobs
| warm render / render + audit: pluck (3 s), impact (4.8 s) | 1.0-1.1 s / 1.4-2.2 s |
| a targeted whoosh (dur + apex: up to 3 renders + audit) | 1.9 s |
| render + audit, median over the 186 forge sounds and plucks (a cold process per batch) | 0.5 s |
-| `kit render`, whole preset, fresh process | calm 28 s (57 takes), crisp 81 s (59), minimal 24 s (58), with the fitted sounds |
+| `kit render`, whole preset, fresh process | calm 34 s (64 takes), crisp 22 s (64), minimal 9 s (63), with the fitted sounds (inside the process, numba kernels cached; the first run after an install adds the compile) |
| `kit render`, everything cached | 3-5 s (the process start; 0.1-0.6 s inside it) |
Render a film's sounds in one process and keep the takes: the lock and its cache are made for that.
@@ -383,7 +407,8 @@ Render a film's sounds in one process and keep the takes: the lock and its cache
## Limits
- The bank is the forge's sound plus 15 fitted recordings, chosen and checked by measurement; it is not a library of
- recordings. Measurements (realness, a match against a role's description, the audit) are models and heuristics,
+ recordings. No blind listening result for the v2 sounds is published: the README's blind test covers the v1 recipes
+ (one listener, the author, 15 trials), and `eval/forge/blind_v2.py` builds the kit for a v2 test. Measurements (realness, a match against a role's description, the audit) are models and heuristics,
not ears: a film's own listening pass still decides.
- Bit-exact re-renders hold on the machine that built the bank; another platform (numpy, scipy, numba versions) can
differ by tiny amounts, which is why entries carry fingerprints with tolerances instead of hashes.
diff --git a/earshot/forge/bank.py b/earshot/forge/bank.py
index 266f592..de40dea 100644
--- a/earshot/forge/bank.py
+++ b/earshot/forge/bank.py
@@ -22,7 +22,8 @@ searching, rounded and without their render function; re-rendered from them, a t
as different sounds. A bank entry is the final's schema-2 render block (earshot.forge.schema) at full precision, and
`build` refuses any final whose block does not re-render its delivered WAV (within one 24-bit step).
-Bank file (earshot/forge/bank/*.json, package data; extra files: EARSHOT_BANK=path[;path...]):
+Bank file (earshot/forge/bank/*.json, package data; extra files: EARSHOT_BANK, paths joined by os.pathsep: ';' on
+Windows, ':' elsewhere; a missing or unreadable one is a BankError naming it):
{"bank": 1, "name": "forge_v2", "version": "forge_v2r6", "earshot": "0.3.0", "note": "...",
"categories": {"click": {"recipe": "click", "target": "...", "kinds": ["click"], "use": "..."}, ...},
"entries": {"click/soft": {<entry>}, ...}}
@@ -60,6 +61,7 @@ BANK_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bank')
FORMAT = 1
FORGE_VERSION = 'forge_v2r6' # the delivery the shipped forge_v2.json was built from (forge v2, round 6)
PEAK_DB = -1.0
+SRS = (44100, 48000, 88200, 96000) # the sample rates a take is written at (render, sfx render, kit sr)
ENV_DB = -30.0 # onset: the 1 ms envelope's first point within this of its maximum
END_DB = -50.0 # end: the last 5 ms frame within this of the loudest
FP_HOP = 0.05 # fingerprint frame (s)
@@ -136,8 +138,13 @@ def _files():
def _read(path):
- with open(path, encoding='utf-8') as fh:
- d = json.load(fh)
+ try:
+ with open(path, encoding='utf-8') as fh:
+ d = json.load(fh)
+ except FileNotFoundError:
+ raise BankError(f'EARSHOT_BANK file {path} not found (paths are joined by {os.pathsep!r})') from None
+ except (OSError, ValueError) as e:
+ raise BankError(f'{path}: not readable as a bank file ({type(e).__name__}: {e})') from None
if not isinstance(d, dict) or d.get('bank') != FORMAT or not isinstance(d.get('entries'), dict):
raise BankError(f'{path}: not an earshot bank file (bank: {FORMAT} with entries)')
return d
@@ -262,12 +269,42 @@ def normalize(x, peak_db=PEAK_DB):
return np.asarray(x, np.float64) * (10 ** (peak_db / 20) / (np.abs(x).max() + 1e-12))
+def level(peak_db=PEAK_DB, weight=None):
+ """the sample peak (dBFS) a take is written at: peak_db, moved 6 dB per doubling of weight. BankError for a
+ level over 0 dBFS (a clipped take), a weight outside (0, 4] or a value that is no number"""
+ def num(v, name):
+ if isinstance(v, bool) or not isinstance(v, (int, float, np.integer, np.floating)) or not np.isfinite(v):
+ raise BankError(f'{name} must be a number, got {v!r}')
+ return float(v)
+ lv = num(peak_db, 'peak_db')
+ if lv > 0:
+ raise BankError(f'peak_db {lv:g} is over 0 dBFS: the take would clip (use 0 or less)')
+ if weight is not None:
+ w = num(weight, 'weight')
+ if not 0 < w <= 4:
+ raise BankError(f'weight must be in (0, 4], got {weight}')
+ lv += 20 * np.log10(w)
+ if lv > 0:
+ raise BankError(f'weight {w:g} at peak_db {peak_db:g} puts the peak at {lv:+.1f} dBFS: lower peak_db')
+ return float(lv)
+
+
+def check_sr(sr):
+ """sr as an int when it is one of SRS (an integral float such as 48000.0 too), else BankError"""
+ ok = not isinstance(sr, bool) and isinstance(sr, (int, float, np.integer, np.floating)) and float(sr) in SRS
+ if not ok:
+ raise BankError(f'sr must be one of {", ".join(map(str, SRS))}, got {sr!r}')
+ return int(sr)
+
+
def render(sound_id, seed=None, dur=None, apex=None, pitch=None, peak_db=PEAK_DB, sr=SR, weight=None, checks=True):
"""one take of a bank sound: (y float32 (n,) or (n, 2), meta). seed None = the entry's own seed (the delivered
final); dur / apex (s), pitch ('E5' or Hz) aim it through the recipe's own parameters (earshot.forge.knobs);
- peak_db = its sample peak; weight scales that by 6 dB per doubling (1 = peak_db, 0.5 = 6 dB down; a weight that
- would push the peak over 0 dBFS is refused). sr != 48000 resamples the finished take (soxr). checks=False skips
- the model-free audit (meta['checks'] None)."""
+ peak_db = its sample peak (0 dBFS or less); weight scales that by 6 dB per doubling (1 = peak_db, 0.5 = 6 dB
+ down; a level over 0 dBFS is refused: level()). sr (one of SRS) != 48000 resamples the finished take (soxr).
+ checks=False skips the model-free audit (meta['checks'] None)."""
+ lv = level(peak_db, weight)
+ sr = check_sr(sr)
e = sound_id if isinstance(sound_id, dict) else get(sound_id)
sid = e.get('id')
run = renderer(e, seed)
@@ -276,21 +313,16 @@ def render(sound_id, seed=None, dur=None, apex=None, pitch=None, peak_db=PEAK_DB
x, edits = knobs.apply(e, run, dur=dur, apex=apex, pitch=pitch)
else:
x, edits = run(), {}
- level = float(peak_db)
+ level_db = lv
if weight is not None:
- w = float(weight)
- if not 0 < w <= 4:
- raise BankError(f'weight must be in (0, 4], got {weight}')
- level = peak_db + 20 * np.log10(w)
- edits['weight'] = {'weight': w, 'peak_db': round(level, 2)}
- if level > 0:
- raise BankError(f'weight {w:g} at peak_db {peak_db:g} puts the peak at {level:+.1f} dBFS: lower peak_db')
- y = normalize(x, level).astype(np.float32)
+ edits['weight'] = {'weight': float(weight), 'peak_db': round(level_db, 2)}
+ y = normalize(x, level_db).astype(np.float32)
meta = {'id': sid, 'seed': int(e['seed'] if seed is None else seed), 'sr': int(sr), **measure(y),
'edits': edits, 'checks': None}
if checks:
from . import sfx
meta['checks'] = sfx.check(y, category=e.get('category'), sound=sid)
+ add_warning(meta['checks'], knobs.pitch_warning(edits))
if int(sr) != SR:
import soxr
y = np.asarray(soxr.resample(y, SR, int(sr)), np.float32)
@@ -298,6 +330,18 @@ def render(sound_id, seed=None, dur=None, apex=None, pitch=None, peak_db=PEAK_DB
return y, meta
+def add_warning(c, w):
+ """add one warning ({code, msg} or None) to an audit result (sfx.check): ok becomes False, the summary says it"""
+ if not w:
+ return c
+ c['warnings'].append(w)
+ c['ok'] = False
+ name = c['summary'].split(':', 1)[0]
+ c['summary'] = (f"{name}: {len(c['warnings'])} warning{'s' if len(c['warnings']) != 1 else ''}: "
+ + '; '.join(x['msg'] for x in c['warnings']))
+ return c
+
+
def render_final(sound_id):
"""a forge entry at its delivered level (schema.rerender: the palette gain included): the WAV the forge wrote"""
from . import schema
@@ -483,6 +527,7 @@ def build(dirs, out, version=FORGE_VERSION, tol=None, log=print):
**{k: b[k] for k in ('recipe', 'fn', 'params', 'seed', 'peak_db', 'gain_db', 'gain', 'mode')
if k in b}}
e['meta'] = meta_of(normalize(x).astype(np.float32))
+ add_partial(e, x)
entries[sid] = e
if log:
log(f" {sid:30s} {e['meta']['dur_s']:6.3f} s err {err:.1e}")
@@ -499,6 +544,17 @@ def build(dirs, out, version=FORGE_VERSION, tol=None, log=print):
return doc
+def add_partial(e, x=None):
+ """meta['pitch_hz'] of a click / toggle entry: its heard partial (knobs.partial_hz on its own render), None when it
+ has no clear one; other entries are left as they are. Returns the entry"""
+ from . import knobs
+ if (knobs.PITCH.get(e.get('category')) or {}).get('partial') and e.get('type', 'forge') == 'forge':
+ x = renderer(e)() if x is None else x
+ f = knobs.partial_hz(e, x)
+ e.setdefault('meta', {})['pitch_hz'] = None if f is None else round(float(f), 2)
+ return e
+
+
def _pluck_params(edit):
from .recipes import pluck
p = {**pluck.DEFAULTS, 'f0': PLUCK_F0}
diff --git a/earshot/forge/bank/forge_v2.json b/earshot/forge/bank/forge_v2.json
index ba2d856..0066cf4 100644
--- a/earshot/forge/bank/forge_v2.json
+++ b/earshot/forge/bank/forge_v2.json
@@ -36,11 +36,11 @@
"whoosh_fast": {"recipe": "whoosh", "target": "a fast crisp air whoosh", "kinds": ["whoosh.short", "suck"], "use": "whip pans, fast fly-ins, element moves"}
},
"entries": {
- "click/soft": {"type": "forge", "category": "click", "member": "soft", "recipe": "click", "fn": "render", "params": {"pitch": 2454.3368817127594, "bright": 0.5, "snap_ms": 0.35513777494102333, "tone": 0.4061140628101816, "partials": 1, "inharm": 2.634273232245259, "tink_ms": 2.8344426533985705, "body": 0.14559331105987836, "body_f": 323.8056902894124, "body_ms": 3.19796041541155, "body_drop": 0.09330080908872478, "grit": 0.431862756365356, "grit_ms": 23.839620006395457, "rel": 0.08, "rel_dt": 0.03284791676548659, "room": 0.16627558313275542, "verb": 0.21772590486847798, "rt": 0.18024377317043566, "hp": 184.92545180552727, "lp": 11281.558169079794, "deharsh": 1.0387138911973015, "deharsh_f": 3605.320448129903, "sat": 4.796556892756605, "attack_ms": 0.10041931118316348, "length": 0.09177373580739574, "release_ms": 9.617535732856659, "width": 0.03029186038715962}, "seed": 76560324, "peak_db": -1.0, "gain_db": -3.78, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.088, "dur_s": 0.0938, "lufs_m_max": -21.81, "attack_ms": 0.5, "centroid_hz": 2573.7, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -29.6]}}},
- "click/thock": {"type": "forge", "category": "click", "member": "thock", "recipe": "click", "fn": "render", "params": {"pitch": 1215.587562454785, "bright": 0.0886189749300824, "snap_ms": 0.4767015683294022, "tone": 0.043614715801039886, "partials": 1, "inharm": 1.2670570159217658, "tink_ms": 1.9446114224314963, "body": 0.6124163150628732, "body_f": 136.4420714611306, "body_ms": 4.379798292759903, "body_drop": 0.3081335422786331, "grit": 0.18043527369914036, "grit_ms": 9.464618314542518, "rel": 0.009019534978357335, "rel_dt": 0.03134457821863986, "room": 0.10239278818372168, "verb": 0.2006547547471112, "rt": 0.18803241148321526, "hp": 63.57697226970951, "lp": 6911.786229306452, "deharsh": 0.5190464614389538, "deharsh_f": 3983.3105606853455, "sat": 1.1772331824347229, "attack_ms": 0.6299126843349102, "length": 0.10057895934967552, "release_ms": 3.972832636319794, "width": 0.06934611313649712}, "seed": 992592500, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.093, "dur_s": 0.1026, "lufs_m_max": -25.59, "attack_ms": 0.75, "centroid_hz": 462.4, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -31.2]}}},
- "click/tink": {"type": "forge", "category": "click", "member": "tink", "recipe": "click", "fn": "render", "params": {"pitch": 5248.916789189572, "bright": 0.6625705903069727, "snap_ms": 1.0198093856171213, "tone": 0.3393163641991497, "partials": 2, "inharm": 1.7045879441921814, "tink_ms": 2.113510961339117, "body": 0.028620733555463154, "body_f": 873.8346287955503, "body_ms": 2.0652019495823315, "body_drop": 0.46638690223630386, "grit": 0.3649658288132044, "grit_ms": 3.038698585035216, "rel": 0.0, "rel_dt": 0.05803468157311822, "room": 0.21428775752365142, "verb": 0.08698863418507399, "rt": 0.3253754421606414, "hp": 654.2844043994262, "lp": 14633.192658386683, "deharsh": 0.2896525418354143, "deharsh_f": 3885.210588493611, "sat": 4.671610963009882, "attack_ms": 1.2474538464316256, "length": 0.06745317523083129, "release_ms": 10.38562430948556, "width": 0.18971251660184055}, "seed": 2032936675, "peak_db": -1.0, "gain_db": -2.39, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.065, "dur_s": 0.0695, "lufs_m_max": -23.2, "attack_ms": 0.5, "centroid_hz": 7282.0, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -40.2]}}},
- "click/snap": {"type": "forge", "category": "click", "member": "snap", "recipe": "click", "fn": "render", "params": {"pitch": 2377.9013525940063, "bright": 0.35017253146126115, "snap_ms": 1.2166431685628134, "tone": 0.10084788439901457, "partials": 3, "inharm": 2.637811243777654, "tink_ms": 2.8355415172912246, "body": 0.03191228474716519, "body_f": 218.24835204490893, "body_ms": 3.8042179882425344, "body_drop": 0.007706588060580999, "grit": 0.3692396180053581, "grit_ms": 3.3571996318772968, "rel": 0.5066642729520937, "rel_dt": 0.01183500557143564, "room": 0.16472398172303016, "verb": 0.09454981651806237, "rt": 0.1076863405113906, "hp": 93.63182157047964, "lp": 13885.11029524368, "deharsh": 1.814997846752268, "deharsh_f": 3657.069604239126, "sat": 4.460600452030664, "attack_ms": 1.356857701909059, "length": 0.06015283503196627, "release_ms": 12.14106211251978, "width": 0.19184647932888754}, "seed": 1664770360, "peak_db": -1.0, "gain_db": -2.09, "mode": "designed", "meta": {"onset_s": 0.0015, "peak_s": 0.0045, "end_s": 0.058, "dur_s": 0.0621, "lufs_m_max": -23.5, "attack_ms": 0.75, "centroid_hz": 3486.9, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -46.1]}}},
- "click/double": {"type": "forge", "category": "click", "member": "double", "recipe": "click", "fn": "render", "params": {"pitch": 2402.868491770109, "bright": 0.7166083840628342, "snap_ms": 0.26180913946489265, "tone": 0.06539835121974988, "partials": 1, "inharm": 2.632841136619909, "tink_ms": 1.9819114176634092, "body": 0.20236578266773683, "body_f": 877.6493284685495, "body_ms": 5.603049914042991, "body_drop": 0.3237305374345596, "grit": 0.205362646328975, "grit_ms": 4.951049517581091, "rel": 0.11938192447993841, "rel_dt": 0.04227373526557511, "room": 0.20766146725643508, "verb": 0.16148122275439772, "rt": 0.21504120776853988, "hp": 163.41172492206806, "lp": 11809.447253698467, "deharsh": 0.44075072160756684, "deharsh_f": 4200.0, "sat": 1.810241572673104, "attack_ms": 0.19473620471395828, "length": 0.10120522837481431, "release_ms": 26.621114188090672, "width": 0.1069666689764414}, "seed": 401884446, "peak_db": -1.0, "gain_db": -0.43, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.087, "dur_s": 0.1032, "lufs_m_max": -25.16, "attack_ms": 0.5, "centroid_hz": 1772.5, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -28.4]}}},
+ "click/soft": {"type": "forge", "category": "click", "member": "soft", "recipe": "click", "fn": "render", "params": {"pitch": 2454.3368817127594, "bright": 0.5, "snap_ms": 0.35513777494102333, "tone": 0.4061140628101816, "partials": 1, "inharm": 2.634273232245259, "tink_ms": 2.8344426533985705, "body": 0.14559331105987836, "body_f": 323.8056902894124, "body_ms": 3.19796041541155, "body_drop": 0.09330080908872478, "grit": 0.431862756365356, "grit_ms": 23.839620006395457, "rel": 0.08, "rel_dt": 0.03284791676548659, "room": 0.16627558313275542, "verb": 0.21772590486847798, "rt": 0.18024377317043566, "hp": 184.92545180552727, "lp": 11281.558169079794, "deharsh": 1.0387138911973015, "deharsh_f": 3605.320448129903, "sat": 4.796556892756605, "attack_ms": 0.10041931118316348, "length": 0.09177373580739574, "release_ms": 9.617535732856659, "width": 0.03029186038715962}, "seed": 76560324, "peak_db": -1.0, "gain_db": -3.78, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.088, "dur_s": 0.0938, "lufs_m_max": -21.81, "attack_ms": 0.5, "centroid_hz": 2573.7, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -29.6]}, "pitch_hz": 2903.41}},
+ "click/thock": {"type": "forge", "category": "click", "member": "thock", "recipe": "click", "fn": "render", "params": {"pitch": 1215.587562454785, "bright": 0.0886189749300824, "snap_ms": 0.4767015683294022, "tone": 0.043614715801039886, "partials": 1, "inharm": 1.2670570159217658, "tink_ms": 1.9446114224314963, "body": 0.6124163150628732, "body_f": 136.4420714611306, "body_ms": 4.379798292759903, "body_drop": 0.3081335422786331, "grit": 0.18043527369914036, "grit_ms": 9.464618314542518, "rel": 0.009019534978357335, "rel_dt": 0.03134457821863986, "room": 0.10239278818372168, "verb": 0.2006547547471112, "rt": 0.18803241148321526, "hp": 63.57697226970951, "lp": 6911.786229306452, "deharsh": 0.5190464614389538, "deharsh_f": 3983.3105606853455, "sat": 1.1772331824347229, "attack_ms": 0.6299126843349102, "length": 0.10057895934967552, "release_ms": 3.972832636319794, "width": 0.06934611313649712}, "seed": 992592500, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.093, "dur_s": 0.1026, "lufs_m_max": -25.59, "attack_ms": 0.75, "centroid_hz": 462.4, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -31.2]}, "pitch_hz": null}},
+ "click/tink": {"type": "forge", "category": "click", "member": "tink", "recipe": "click", "fn": "render", "params": {"pitch": 5248.916789189572, "bright": 0.6625705903069727, "snap_ms": 1.0198093856171213, "tone": 0.3393163641991497, "partials": 2, "inharm": 1.7045879441921814, "tink_ms": 2.113510961339117, "body": 0.028620733555463154, "body_f": 873.8346287955503, "body_ms": 2.0652019495823315, "body_drop": 0.46638690223630386, "grit": 0.3649658288132044, "grit_ms": 3.038698585035216, "rel": 0.0, "rel_dt": 0.05803468157311822, "room": 0.21428775752365142, "verb": 0.08698863418507399, "rt": 0.3253754421606414, "hp": 654.2844043994262, "lp": 14633.192658386683, "deharsh": 0.2896525418354143, "deharsh_f": 3885.210588493611, "sat": 4.671610963009882, "attack_ms": 1.2474538464316256, "length": 0.06745317523083129, "release_ms": 10.38562430948556, "width": 0.18971251660184055}, "seed": 2032936675, "peak_db": -1.0, "gain_db": -2.39, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.065, "dur_s": 0.0695, "lufs_m_max": -23.2, "attack_ms": 0.5, "centroid_hz": 7282.0, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -40.2]}, "pitch_hz": 5373.64}},
+ "click/snap": {"type": "forge", "category": "click", "member": "snap", "recipe": "click", "fn": "render", "params": {"pitch": 2377.9013525940063, "bright": 0.35017253146126115, "snap_ms": 1.2166431685628134, "tone": 0.10084788439901457, "partials": 3, "inharm": 2.637811243777654, "tink_ms": 2.8355415172912246, "body": 0.03191228474716519, "body_f": 218.24835204490893, "body_ms": 3.8042179882425344, "body_drop": 0.007706588060580999, "grit": 0.3692396180053581, "grit_ms": 3.3571996318772968, "rel": 0.5066642729520937, "rel_dt": 0.01183500557143564, "room": 0.16472398172303016, "verb": 0.09454981651806237, "rt": 0.1076863405113906, "hp": 93.63182157047964, "lp": 13885.11029524368, "deharsh": 1.814997846752268, "deharsh_f": 3657.069604239126, "sat": 4.460600452030664, "attack_ms": 1.356857701909059, "length": 0.06015283503196627, "release_ms": 12.14106211251978, "width": 0.19184647932888754}, "seed": 1664770360, "peak_db": -1.0, "gain_db": -2.09, "mode": "designed", "meta": {"onset_s": 0.0015, "peak_s": 0.0045, "end_s": 0.058, "dur_s": 0.0621, "lufs_m_max": -23.5, "attack_ms": 0.75, "centroid_hz": 3486.9, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -46.1]}, "pitch_hz": 2206.13}},
+ "click/double": {"type": "forge", "category": "click", "member": "double", "recipe": "click", "fn": "render", "params": {"pitch": 2402.868491770109, "bright": 0.7166083840628342, "snap_ms": 0.26180913946489265, "tone": 0.06539835121974988, "partials": 1, "inharm": 2.632841136619909, "tink_ms": 1.9819114176634092, "body": 0.20236578266773683, "body_f": 877.6493284685495, "body_ms": 5.603049914042991, "body_drop": 0.3237305374345596, "grit": 0.205362646328975, "grit_ms": 4.951049517581091, "rel": 0.11938192447993841, "rel_dt": 0.04227373526557511, "room": 0.20766146725643508, "verb": 0.16148122275439772, "rt": 0.21504120776853988, "hp": 163.41172492206806, "lp": 11809.447253698467, "deharsh": 0.44075072160756684, "deharsh_f": 4200.0, "sat": 1.810241572673104, "attack_ms": 0.19473620471395828, "length": 0.10120522837481431, "release_ms": 26.621114188090672, "width": 0.1069666689764414}, "seed": 401884446, "peak_db": -1.0, "gain_db": -0.43, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.087, "dur_s": 0.1032, "lufs_m_max": -25.16, "attack_ms": 0.5, "centroid_hz": 1772.5, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -28.4]}, "pitch_hz": 2913.51}},
"downlifter/shepard_fall": {"type": "forge", "category": "downlifter", "member": "shepard_fall", "recipe": "downlifter", "fn": "render", "params": {"length": 3.1209419347592453, "curve": 1.3335187366788426, "drop_db": 33.511763348184964, "att_ms": 297.7927421655405, "noise_db": -9.924879161877332, "nf0": 8448.120441838173, "nf1": 273.06552319978346, "nq": 2.3704813460401395, "pink": 0.7179831273675794, "tone_db": -35.587755771532386, "tmode": "fall", "wave": "sine", "tf0": 829.5375374995182, "toct": 1.1807020574351714, "tbright": 3.1245163986083773, "detune": 6.272594755764493, "tape_curve": 1.3573531066544848, "sub_db": -32.26939180464864, "sub_f0": 81.72233374861803, "sub_f1": 42.607071548342006, "shep_db": -3.3332009383355867, "shep_rate": 0.9043363993712847, "flange": 0.0644151081579431, "fl_rate": 1.3011558516791473, "verb": 0.37892524139221717, "rt60": 2.8872994222813255, "width": 0.9516799898675498, "sat": 0.02779049914948345, "hp": 80.65765503602884}, "seed": 87989972, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0295, "peak_s": 0.2795, "end_s": 3.482, "dur_s": 4.0195, "lufs_m_max": -9.97, "attack_ms": 145.25, "centroid_hz": 929.9, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-27.5, -13.5, -6.5, -2.5, -1.0, 0.0, -1.0, -0.4, -2.3, -2.7, -3.4, -3.3, -4.8, -5.0, -5.5, -6.1, -7.1, -7.1, -7.8, -9.6, -9.3, -10.4, -10.9, -11.0, -12.3, -12.6, -12.7, -14.2, -14.5, -15.7, -14.9, -17.0, -16.7, -18.1, -18.6, -19.1, -19.3, -20.4, -21.5, -20.9, -22.0, -22.4, -24.2, -24.5, -25.5, -25.0, -26.8, -27.1, -27.3, -27.2, -28.5, -28.5, -28.3, -29.4, -31.2, -31.7, -32.7, -35.4, -37.6, -38.8, -40.0, -41.9, -43.3, -44.8, -46.4, -45.9, -48.8, -48.9, -50.0, -50.5, -51.8, -51.8, -51.7, -55.1, -54.4, -56.3, -58.0, -59.0]}}},
"downlifter/flange_air": {"type": "forge", "category": "downlifter", "member": "flange_air", "recipe": "downlifter", "fn": "render", "params": {"length": 2.7209419347592454, "curve": 1.6335187366788426, "drop_db": 37.511763348184964, "att_ms": 271.2634460727455, "noise_db": -2.122439580938668, "nf0": 11264.160589117573, "nf1": 364.08736426637785, "nq": 1.0667166057180628, "pink": 0.5179831273675793, "tone_db": -27.495511543064772, "tmode": "fall", "wave": "tri", "tf0": 1244.3063062492777, "toct": 2.180702057435171, "tbright": 4.16602186481117, "detune": 8.272594755764494, "tape_curve": 1.3573531066544848, "sub_db": -36.26939180464864, "sub_f0": 91.9376254671953, "sub_f1": 40.47671797092492, "shep_db": -45.57320093833559, "shep_rate": 0.8043363993712849, "flange": 0.7328302163158862, "fl_rate": 1.040924681343318, "verb": 0.22892524139221718, "rt60": 2.1173529096729724, "width": 0.8016799898675497, "sat": 0.02779049914948345, "hp": 103.70269933203714}, "seed": 161576974, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0325, "peak_s": 0.2205, "end_s": 2.655, "dur_s": 2.9539, "lufs_m_max": -10.34, "attack_ms": 130.0, "centroid_hz": 2442.4, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-24.3, -11.1, -4.9, -1.9, 0.0, -0.7, -1.6, -3.3, -4.4, -5.5, -5.4, -7.4, -8.2, -9.4, -10.4, -11.3, -13.0, -13.6, -14.7, -16.0, -16.0, -18.1, -17.5, -18.7, -18.9, -19.5, -22.6, -22.1, -23.7, -25.4, -25.5, -26.3, -27.4, -28.3, -28.3, -30.2, -29.2, -29.3, -30.9, -32.5, -31.6, -32.0, -33.7, -34.2, -34.2, -34.5, -35.3, -34.2, -35.4, -37.5, -42.8, -44.2, -50.6, -51.5, -54.8, -54.5, -55.8, -59.5]}}},
"downlifter/synth_fall": {"type": "forge", "category": "downlifter", "member": "synth_fall", "recipe": "downlifter", "fn": "render", "params": {"length": 2.6342464339099867, "curve": 1.6695009372340603, "drop_db": 32.983132445698025, "att_ms": 174.90022052594108, "noise_db": -29.999999087244422, "nf0": 6181.293208227443, "nf1": 333.0438881723641, "nq": 1.2220996961688428, "pink": 0.8044173817090643, "tone_db": -0.7955126461949789, "tmode": "fall", "wave": "saw", "tf0": 642.258085766046, "toct": 2.126769806429329, "tbright": 3.4508394218397704, "detune": 18.614888240919186, "tape_curve": 1.4179112471476074, "sub_db": -32.30731902100933, "sub_f0": 88.59611446352612, "sub_f1": 35.585875548776464, "shep_db": -47.28412832736251, "shep_rate": 0.8532348173844126, "flange": 0.378260386222256, "fl_rate": 1.2892392819952916, "verb": 0.3304578291159964, "rt60": 2.90816873504104, "width": 0.7154004813062952, "sat": 3.445300762753668, "hp": 64.52825347577635}, "seed": 1097657232, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0232, "peak_s": 0.3305, "end_s": 3.109, "dur_s": 4.0389, "lufs_m_max": -6.9, "attack_ms": 63.5, "centroid_hz": 706.4, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-23.5, -7.1, -2.4, -3.8, -3.8, -1.9, 0.0, -4.2, -5.2, -9.6, -5.4, -8.7, -10.9, -10.1, -10.4, -6.6, -7.4, -12.1, -14.1, -15.4, -17.3, -14.7, -16.6, -16.6, -18.0, -17.0, -21.8, -24.4, -20.2, -16.9, -17.0, -19.0, -20.0, -22.2, -22.7, -25.2, -25.6, -25.4, -24.1, -23.9, -25.5, -28.2, -29.6, -28.6, -25.8, -27.0, -28.9, -32.3, -36.9, -36.0, -39.0, -40.6, -42.0, -41.2, -44.5, -46.0, -48.4, -46.6, -48.8, -46.6, -50.8, -51.9, -52.0, -54.2, -54.9, -53.0, -56.9, -56.4, -59.7, -60.0, -59.7]}}},
@@ -80,11 +80,11 @@
"pop/4": {"type": "forge", "category": "pop", "member": "4", "recipe": "pop", "fn": "render", "params": {"q": 22.1207, "wobble": 0.0112906, "breath_amp": 0.0, "breath_tau": 0.00848874, "f2_ratio": 3.82514, "f2_amp": 0.8, "f2_q": 25.0, "f2_follow": 0.948223, "sub_amp": 0.00328062, "sub_ratio": 2.08913, "sub_delay": 0.0111736, "click_amp": 0.685048, "click_w": 7.72837e-05, "tear": 0.000171419, "jerks": 1, "click_lp": 4881.31, "shred_amp": 0.200779, "shred_tau": 0.00153019, "shred_hp": 5000.0, "hiss_amp": 0.0659931, "hiss_f": 2418.88, "hiss_q": 2.86992, "hiss_tau": 0.00113073, "puff_amp": 0.0, "puff_f": 121.063, "ring_delay": 0.00105542, "rt60": 0.249181, "wet": 0.291252, "damp": 0.490701, "size": 0.05, "air_db": -0.476997, "swell_amp": 0.160452, "swell_t": 0.00252584, "pre": 0.0269276, "clip": 0.274425, "cut_fade": 0.0153059, "style": "bubble", "f_hi": 9800.0, "f_lo": 360.0, "sweep": 0.055, "ease": 1.0, "steps": 1.0, "step_ms": 9.0, "duty": 0.62, "pre_db": -2.0, "pre_hz": 9800.0, "pre_t": 0.032, "peak_at": 0.3, "start_db": -2.0, "tail_db": -11.0, "tail_hold": 0.006, "tail_tau": 0.009, "harm": 0.35, "odd": 0.6, "f_blip": 1220.0, "box": 0.005, "b_att": 0.0008, "b_rel": 0.003, "b_drop": 0.0, "b_tau": 0.3, "f0": 450.0, "rise": 0.15, "rise_tau": 0.018349078951823004, "q_tau": 0.01, "att": 0.00042879052090189916, "h2": 0.0, "daughter": 0.15, "d_ratio": 2.4, "d_delay": 0.01041991105874272, "tick_db": -34.38154641605798, "tick_hz": 8748.720301863645, "breath": 0.3633917199422795, "room": 0.177906566221194, "floor_db": -62.17254248306277, "hp": 59.999999999999986, "lp": 7629.54913176197, "drive": 4.426071269577357, "length": 0.22, "fade": 0.017806119994242364, "width": 0.13861685889120437}, "seed": 661058652, "peak_db": -1.0, "gain_db": 0.0, "mode": "real", "meta": {"onset_s": 0.0, "peak_s": 0.0035, "end_s": 0.128, "dur_s": 0.22, "lufs_m_max": -19.36, "attack_ms": 1.5, "centroid_hz": 498.8, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -26.4, -41.7, -53.8]}}},
"pop/2": {"type": "forge", "category": "pop", "member": "2", "recipe": "pop", "fn": "render", "params": {"q": 22.1207, "wobble": 0.0112906, "breath_amp": 0.0, "breath_tau": 0.00848874, "f2_ratio": 3.82514, "f2_amp": 0.8, "f2_q": 25.0, "f2_follow": 0.948223, "sub_amp": 0.00328062, "sub_ratio": 2.08913, "sub_delay": 0.0111736, "click_amp": 0.685048, "click_w": 7.72837e-05, "tear": 0.000171419, "jerks": 1, "click_lp": 4881.31, "shred_amp": 0.200779, "shred_tau": 0.00153019, "shred_hp": 5000.0, "hiss_amp": 0.0659931, "hiss_f": 2418.88, "hiss_q": 2.86992, "hiss_tau": 0.00113073, "puff_amp": 0.0, "puff_f": 121.063, "ring_delay": 0.00105542, "rt60": 0.249181, "wet": 0.291252, "damp": 0.490701, "size": 0.05, "air_db": -0.476997, "swell_amp": 0.160452, "swell_t": 0.00252584, "pre": 0.0269276, "clip": 0.274425, "cut_fade": 0.0153059, "style": "bubble", "f_hi": 9800.0, "f_lo": 360.0, "sweep": 0.055, "ease": 1.0, "steps": 1.0, "step_ms": 9.0, "duty": 0.62, "pre_db": -2.0, "pre_hz": 9800.0, "pre_t": 0.032, "peak_at": 0.3, "start_db": -2.0, "tail_db": -11.0, "tail_hold": 0.006, "tail_tau": 0.009, "harm": 0.35, "odd": 0.6, "f_blip": 1220.0, "box": 0.005, "b_att": 0.0008, "b_rel": 0.003, "b_drop": 0.0, "b_tau": 0.3, "f0": 330.0, "rise": 1.3, "rise_tau": 0.022727224128771237, "q_tau": 0.03, "att": 0.0013349328923309824, "h2": 0.08266302259882136, "daughter": 0.0, "d_ratio": 2.2698713919940547, "d_delay": 0.012000890800765268, "tick_db": -18.759479530443908, "tick_hz": 7919.1190077835345, "breath": 0.3814892673852262, "room": 0.2228252699070559, "floor_db": -70.37778305927647, "hp": 136.3599460612784, "lp": 11477.53816445782, "drive": 5.585800283556781, "length": 0.25, "fade": 0.004805518506524182, "width": 0.2139095358002209}, "seed": 1097657232, "peak_db": -1.0, "gain_db": 0.0, "mode": "real", "meta": {"onset_s": 0.0, "peak_s": 0.0095, "end_s": 0.198, "dur_s": 0.25, "lufs_m_max": -14.62, "attack_ms": 6.75, "centroid_hz": 553.0, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -11.4, -25.1, -38.8, -50.7]}}},
"pop/1": {"type": "forge", "category": "pop", "member": "1", "recipe": "pop", "fn": "render", "params": {"q": 22.1207, "wobble": 0.0112906, "breath_amp": 0.0, "breath_tau": 0.00848874, "f2_ratio": 3.82514, "f2_amp": 0.8, "f2_q": 25.0, "f2_follow": 0.948223, "sub_amp": 0.00328062, "sub_ratio": 2.08913, "sub_delay": 0.0111736, "click_amp": 0.685048, "click_w": 7.72837e-05, "tear": 0.000171419, "jerks": 1, "click_lp": 4881.31, "shred_amp": 0.200779, "shred_tau": 0.00153019, "shred_hp": 5000.0, "hiss_amp": 0.0659931, "hiss_f": 2418.88, "hiss_q": 2.86992, "hiss_tau": 0.00113073, "puff_amp": 0.0, "puff_f": 121.063, "ring_delay": 0.00105542, "rt60": 0.249181, "wet": 0.291252, "damp": 0.490701, "size": 0.05, "air_db": -0.476997, "swell_amp": 0.160452, "swell_t": 0.00252584, "pre": 0.0269276, "clip": 0.274425, "cut_fade": 0.0153059, "style": "bubble", "f_hi": 9800.0, "f_lo": 360.0, "sweep": 0.055, "ease": 1.0, "steps": 1.0, "step_ms": 9.0, "duty": 0.62, "pre_db": -2.0, "pre_hz": 9800.0, "pre_t": 0.032, "peak_at": 0.3, "start_db": -2.0, "tail_db": -11.0, "tail_hold": 0.006, "tail_tau": 0.009, "harm": 0.35, "odd": 0.6, "f_blip": 1220.0, "box": 0.005, "b_att": 0.0008, "b_rel": 0.003, "b_drop": 0.0, "b_tau": 0.3, "f0": 1100.0, "rise": 0.55, "rise_tau": 0.016665778371108563, "q_tau": 0.009, "att": 0.0006449815753953483, "h2": 0.29766043505306927, "daughter": 0.3, "d_ratio": 1.486898992537717, "d_delay": 0.01343601638609042, "tick_db": -26.10752009095835, "tick_hz": 3338.689944691473, "breath": 0.0754713596094911, "room": 0.11343621471694672, "floor_db": -62.0, "hp": 59.999999999999986, "lp": 9066.20414418906, "drive": 3.8860022459323056, "length": 0.15, "fade": 0.006302537988601036, "width": 0.04967470439098241}, "seed": 1367864807, "peak_db": -1.0, "gain_db": 0.0, "mode": "real", "meta": {"onset_s": 0.0, "peak_s": 0.0035, "end_s": 0.097, "dur_s": 0.15, "lufs_m_max": -17.76, "attack_ms": 1.75, "centroid_hz": 1316.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -34.1, -50.6]}}},
- "pro_click/tink": {"type": "forge", "category": "pro_click", "member": "tink", "recipe": "click", "fn": "render", "params": {"pitch": 6525.899273970625, "bright": 0.09599453394338342, "snap_ms": 0.20782299385079503, "tone": 0.7203889580764304, "partials": 2, "inharm": 1.3449432521917937, "tink_ms": 2.7067605634490226, "body": 0.07047735368710152, "body_f": 616.4084371078736, "body_ms": 4.280948385874262, "body_drop": 0.19859141047708018, "grit": 0.5192850456430426, "grit_ms": 14.999573198243127, "rel": 0.440433813495477, "rel_dt": 0.009508867775315956, "room": 0.051407175722092024, "verb": 0.0, "rt": 0.08690837302568422, "hp": 696.2542412922484, "lp": 11183.736884044454, "deharsh": 4.437997603550581, "deharsh_f": 2981.1022969383953, "sat": 6.794103045284953, "attack_ms": 0.7403857382528306, "length": 0.03528658501112835, "release_ms": 5.828759099464182, "width": 0.09965153217927641}, "seed": 1162705466, "peak_db": -1.0, "gain_db": -7.29, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.036, "dur_s": 0.0373, "lufs_m_max": -18.1, "attack_ms": 1.0, "centroid_hz": 7094.4, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}}},
- "pro_click/snap": {"type": "forge", "category": "pro_click", "member": "snap", "recipe": "click", "fn": "render", "params": {"pitch": 6192.382303652206, "bright": 0.5052620108990794, "snap_ms": 0.39478057905842584, "tone": 0.3, "partials": 2, "inharm": 1.6671219056386768, "tink_ms": 2.988243761133858, "body": 0.12012061308121026, "body_f": 605.6271605920011, "body_ms": 4.8261641261353665, "body_drop": 0.15040390728691402, "grit": 0.1581823052472703, "grit_ms": 6.578089036742619, "rel": 0.3052868513453689, "rel_dt": 0.01584378462062052, "room": 0.04529486424343825, "verb": 0.0, "rt": 0.10612767679305644, "hp": 249.9999999999999, "lp": 16458.725401323387, "deharsh": 2.801438470976894, "deharsh_f": 3235.908531886355, "sat": 1.8877831495185193, "attack_ms": 0.2887802701339366, "length": 0.045, "release_ms": 7.613610075368238, "width": 0.03616947600127607}, "seed": 726570697, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.039, "dur_s": 0.047, "lufs_m_max": -25.39, "attack_ms": 0.5, "centroid_hz": 7263.5, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}}},
- "pro_click/mouse": {"type": "forge", "category": "pro_click", "member": "mouse", "recipe": "click", "fn": "render", "params": {"pitch": 3140.355232532964, "bright": 0.8099624019321154, "snap_ms": 0.7757814230473565, "tone": 0.18568778722972984, "partials": 2, "inharm": 2.0811871826350723, "tink_ms": 2.755144788992272, "body": 0.39113900441419497, "body_f": 549.2305401935718, "body_ms": 3.7109946961286004, "body_drop": 0.3777000910646809, "grit": 0.31455171013344724, "grit_ms": 4.931207423778236, "rel": 0.0, "rel_dt": 0.042314349847135335, "room": 0.04492153915150476, "verb": 0.0, "rt": 0.27255972689153896, "hp": 166.69680183463885, "lp": 11519.877870861223, "deharsh": 2.1314088771018613, "deharsh_f": 3619.8729653444084, "sat": 3.548908023347437, "attack_ms": 0.32738048781153095, "length": 0.05167979240829363, "release_ms": 5.142930551141057, "width": 0.14446765541569317}, "seed": 503102719, "peak_db": -1.0, "gain_db": -2.55, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.029, "dur_s": 0.0537, "lufs_m_max": -22.84, "attack_ms": 1.0, "centroid_hz": 1134.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}}},
- "pro_click/glass": {"type": "forge", "category": "pro_click", "member": "glass", "recipe": "click", "fn": "render", "params": {"pitch": 8064.272044391264, "bright": 0.3511844584105839, "snap_ms": 0.6065012127020717, "tone": 0.7943191719595194, "partials": 3, "inharm": 1.6742159319504852, "tink_ms": 4.545992278596442, "body": 0.05208696470860614, "body_f": 960.7419454691345, "body_ms": 2.5737368877995426, "body_drop": 0.138929838557369, "grit": 0.45741325563305024, "grit_ms": 14.548849161084297, "rel": 0.0, "rel_dt": 0.07297192952661904, "room": 0.08325007784854163, "verb": 0.0, "rt": 0.23157442387324934, "hp": 558.394040656272, "lp": 9495.240913031781, "deharsh": 4.8504114452117255, "deharsh_f": 3137.1853552377183, "sat": 7.31518346533215, "attack_ms": 0.18295336692339992, "length": 0.059741782734064525, "release_ms": 8.545636027464383, "width": 0.19314203335123178}, "seed": 1825246568, "peak_db": -1.0, "gain_db": -6.36, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.035, "dur_s": 0.0617, "lufs_m_max": -19.03, "attack_ms": 0.75, "centroid_hz": 8255.6, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}}},
- "pro_click/soft": {"type": "forge", "category": "pro_click", "member": "soft", "recipe": "click", "fn": "render", "params": {"pitch": 5452.139861093992, "bright": 0.7456454100429882, "snap_ms": 0.22299563341779802, "tone": 0.6688478075877917, "partials": 2, "inharm": 1.25, "tink_ms": 1.5612493240054441, "body": 0.2937497812457004, "body_f": 724.894727197121, "body_ms": 3.0992899039718305, "body_drop": 0.3314620018400937, "grit": 0.13689245778960288, "grit_ms": 12.072930135238927, "rel": 0.0, "rel_dt": 0.038694762017315455, "room": 0.22121749974484134, "verb": 0.0, "rt": 0.16744434129003619, "hp": 172.98722640787335, "lp": 15240.839765808292, "deharsh": 2.0, "deharsh_f": 2707.9555274649556, "sat": 1.890347357634528, "attack_ms": 0.6275278276696683, "length": 0.051197200254877714, "release_ms": 4.524130653767595, "width": 0.04083014993434443}, "seed": 267885885, "peak_db": -1.0, "gain_db": -0.42, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.024, "dur_s": 0.0532, "lufs_m_max": -24.97, "attack_ms": 0.75, "centroid_hz": 4356.8, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}}},
+ "pro_click/tink": {"type": "forge", "category": "pro_click", "member": "tink", "recipe": "click", "fn": "render", "params": {"pitch": 6525.899273970625, "bright": 0.09599453394338342, "snap_ms": 0.20782299385079503, "tone": 0.7203889580764304, "partials": 2, "inharm": 1.3449432521917937, "tink_ms": 2.7067605634490226, "body": 0.07047735368710152, "body_f": 616.4084371078736, "body_ms": 4.280948385874262, "body_drop": 0.19859141047708018, "grit": 0.5192850456430426, "grit_ms": 14.999573198243127, "rel": 0.440433813495477, "rel_dt": 0.009508867775315956, "room": 0.051407175722092024, "verb": 0.0, "rt": 0.08690837302568422, "hp": 696.2542412922484, "lp": 11183.736884044454, "deharsh": 4.437997603550581, "deharsh_f": 2981.1022969383953, "sat": 6.794103045284953, "attack_ms": 0.7403857382528306, "length": 0.03528658501112835, "release_ms": 5.828759099464182, "width": 0.09965153217927641}, "seed": 1162705466, "peak_db": -1.0, "gain_db": -7.29, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.036, "dur_s": 0.0373, "lufs_m_max": -18.1, "attack_ms": 1.0, "centroid_hz": 7094.4, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}, "pitch_hz": 7506.72}},
+ "pro_click/snap": {"type": "forge", "category": "pro_click", "member": "snap", "recipe": "click", "fn": "render", "params": {"pitch": 6192.382303652206, "bright": 0.5052620108990794, "snap_ms": 0.39478057905842584, "tone": 0.3, "partials": 2, "inharm": 1.6671219056386768, "tink_ms": 2.988243761133858, "body": 0.12012061308121026, "body_f": 605.6271605920011, "body_ms": 4.8261641261353665, "body_drop": 0.15040390728691402, "grit": 0.1581823052472703, "grit_ms": 6.578089036742619, "rel": 0.3052868513453689, "rel_dt": 0.01584378462062052, "room": 0.04529486424343825, "verb": 0.0, "rt": 0.10612767679305644, "hp": 249.9999999999999, "lp": 16458.725401323387, "deharsh": 2.801438470976894, "deharsh_f": 3235.908531886355, "sat": 1.8877831495185193, "attack_ms": 0.2887802701339366, "length": 0.045, "release_ms": 7.613610075368238, "width": 0.03616947600127607}, "seed": 726570697, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.039, "dur_s": 0.047, "lufs_m_max": -25.39, "attack_ms": 0.5, "centroid_hz": 7263.5, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}, "pitch_hz": 7268.6}},
+ "pro_click/mouse": {"type": "forge", "category": "pro_click", "member": "mouse", "recipe": "click", "fn": "render", "params": {"pitch": 3140.355232532964, "bright": 0.8099624019321154, "snap_ms": 0.7757814230473565, "tone": 0.18568778722972984, "partials": 2, "inharm": 2.0811871826350723, "tink_ms": 2.755144788992272, "body": 0.39113900441419497, "body_f": 549.2305401935718, "body_ms": 3.7109946961286004, "body_drop": 0.3777000910646809, "grit": 0.31455171013344724, "grit_ms": 4.931207423778236, "rel": 0.0, "rel_dt": 0.042314349847135335, "room": 0.04492153915150476, "verb": 0.0, "rt": 0.27255972689153896, "hp": 166.69680183463885, "lp": 11519.877870861223, "deharsh": 2.1314088771018613, "deharsh_f": 3619.8729653444084, "sat": 3.548908023347437, "attack_ms": 0.32738048781153095, "length": 0.05167979240829363, "release_ms": 5.142930551141057, "width": 0.14446765541569317}, "seed": 503102719, "peak_db": -1.0, "gain_db": -2.55, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.029, "dur_s": 0.0537, "lufs_m_max": -22.84, "attack_ms": 1.0, "centroid_hz": 1134.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}, "pitch_hz": 3130.72}},
+ "pro_click/glass": {"type": "forge", "category": "pro_click", "member": "glass", "recipe": "click", "fn": "render", "params": {"pitch": 8064.272044391264, "bright": 0.3511844584105839, "snap_ms": 0.6065012127020717, "tone": 0.7943191719595194, "partials": 3, "inharm": 1.6742159319504852, "tink_ms": 4.545992278596442, "body": 0.05208696470860614, "body_f": 960.7419454691345, "body_ms": 2.5737368877995426, "body_drop": 0.138929838557369, "grit": 0.45741325563305024, "grit_ms": 14.548849161084297, "rel": 0.0, "rel_dt": 0.07297192952661904, "room": 0.08325007784854163, "verb": 0.0, "rt": 0.23157442387324934, "hp": 558.394040656272, "lp": 9495.240913031781, "deharsh": 4.8504114452117255, "deharsh_f": 3137.1853552377183, "sat": 7.31518346533215, "attack_ms": 0.18295336692339992, "length": 0.059741782734064525, "release_ms": 8.545636027464383, "width": 0.19314203335123178}, "seed": 1825246568, "peak_db": -1.0, "gain_db": -6.36, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.035, "dur_s": 0.0617, "lufs_m_max": -19.03, "attack_ms": 0.75, "centroid_hz": 8255.6, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}, "pitch_hz": 8146.55}},
+ "pro_click/soft": {"type": "forge", "category": "pro_click", "member": "soft", "recipe": "click", "fn": "render", "params": {"pitch": 5452.139861093992, "bright": 0.7456454100429882, "snap_ms": 0.22299563341779802, "tone": 0.6688478075877917, "partials": 2, "inharm": 1.25, "tink_ms": 1.5612493240054441, "body": 0.2937497812457004, "body_f": 724.894727197121, "body_ms": 3.0992899039718305, "body_drop": 0.3314620018400937, "grit": 0.13689245778960288, "grit_ms": 12.072930135238927, "rel": 0.0, "rel_dt": 0.038694762017315455, "room": 0.22121749974484134, "verb": 0.0, "rt": 0.16744434129003619, "hp": 172.98722640787335, "lp": 15240.839765808292, "deharsh": 2.0, "deharsh_f": 2707.9555274649556, "sat": 1.890347357634528, "attack_ms": 0.6275278276696683, "length": 0.051197200254877714, "release_ms": 4.524130653767595, "width": 0.04083014993434443}, "seed": 267885885, "peak_db": -1.0, "gain_db": -0.42, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.024, "dur_s": 0.0532, "lufs_m_max": -24.97, "attack_ms": 0.75, "centroid_hz": 4356.8, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0]}, "pitch_hz": 5470.21}},
"pro_glitch/standard": {"type": "forge", "category": "pro_glitch", "member": "standard", "recipe": "glitch", "fn": "render", "params": {"dur": 0.68, "crackle": 0.33, "crackle_rate": 220.00000000000009, "crackle_hp": 2159.196798770129, "crackle_db": -21.0, "grid0": 0.034, "grid1": 0.022, "accel": 1.2, "gate": 0.5, "swell": 5.248665090456718, "bits": 5.007671890350025, "srate": 10915.173578778851, "tonal": 0.26705165217006555, "tone_f": 2676.058766082517, "fm": 0.8104925819242136, "slices": 2, "repeat": 0.5313548827675507, "rev": 0.11652371672499734, "pitch_step": 0.5207875746761554, "low_db": -32.0, "decay": 0.22, "lvl_jit": 2.5, "floor_db": -44.0, "width": 0.9996917857853849, "hp": 5337.888603713912, "bright": 2.185674778211979, "drive": 5.118713335789811, "end_tail": 0.007421394382130271, "pattern": 826, "skip": 0.2, "accent_db": 6.0}, "seed": 1826701615, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0085, "peak_s": 0.6595, "end_s": 0.705, "dur_s": 0.7097, "lufs_m_max": -15.25, "attack_ms": 0.75, "centroid_hz": 7867.0, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-27.1, -21.3, -21.8, -17.7, -7.8, -36.5, -7.9, -8.1, -16.2, -9.8, -2.7, -36.0, -6.3, 0.0, -52.4]}}},
"pro_glitch/data": {"type": "forge", "category": "pro_glitch", "member": "data", "recipe": "glitch", "fn": "render", "params": {"dur": 0.64, "crackle": 0.33, "crackle_rate": 220.00000000000009, "crackle_hp": 2159.196798770129, "crackle_db": -21.0, "grid0": 0.034, "grid1": 0.022, "accel": 1.2, "gate": 0.5, "swell": 5.248665090456718, "bits": 5.007671890350025, "srate": 10915.173578778851, "tonal": 0.6, "tone_f": 2400.0000000000005, "fm": 0.4, "slices": 2, "repeat": 0.5313548827675507, "rev": 0.11652371672499734, "pitch_step": 0.5207875746761554, "low_db": -32.0, "decay": 0.22, "lvl_jit": 2.5, "floor_db": -44.0, "width": 0.9996917857853849, "hp": 5337.888603713912, "bright": 2.185674778211979, "drive": 5.118713335789811, "end_tail": 0.007421394382130271, "pattern": 222, "skip": 0.2, "accent_db": 6.0}, "seed": 579362556, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0572, "peak_s": 0.6195, "end_s": 0.666, "dur_s": 0.6697, "lufs_m_max": -16.42, "attack_ms": 1.75, "centroid_hz": 8149.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-49.9, -23.0, -20.1, -17.5, -14.7, -13.0, -14.7, -7.4, -10.9, -12.4, -12.0, -5.1, 0.0, -33.7]}}},
"pro_glitch/crunchy": {"type": "forge", "category": "pro_glitch", "member": "crunchy", "recipe": "glitch", "fn": "render", "params": {"dur": 0.68, "crackle": 0.4, "crackle_rate": 220.00000000000009, "crackle_hp": 2159.196798770129, "crackle_db": -21.0, "grid0": 0.034, "grid1": 0.022, "accel": 1.2, "gate": 0.5, "swell": 3.0, "bits": 4.5, "srate": 2999.9999999999977, "tonal": 0.26705165217006555, "tone_f": 2676.058766082517, "fm": 0.8104925819242136, "slices": 2, "repeat": 0.5313548827675507, "rev": 0.11652371672499734, "pitch_step": 0.5207875746761554, "low_db": -36.0, "decay": 0.22, "lvl_jit": 1.5, "floor_db": -44.0, "width": 0.9996917857853849, "hp": 5337.888603713912, "bright": 2.185674778211979, "drive": 6.0, "end_tail": 0.007421394382130271, "pattern": 333, "skip": 0.2, "accent_db": 4.0}, "seed": 1367864807, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0078, "peak_s": 0.6525, "end_s": 0.705, "dur_s": 0.7097, "lufs_m_max": -18.89, "attack_ms": 2.25, "centroid_hz": 8494.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-22.6, -17.5, -15.6, -16.9, -13.0, -7.8, -13.8, -9.6, -2.6, -10.1, -17.9, -6.2, -4.8, 0.0, -51.9]}}},
@@ -196,11 +196,11 @@
"tap/table": {"type": "forge", "category": "tap", "member": "table", "recipe": "popin", "fn": "render", "params": {"body_f": 100.05904964115797, "drop": 0.2565408488078321, "att_ms": 1.804938244608849, "hold_ms": 1.155098651044409, "sag_db": 4.38497416501729, "rel_ms": 3.5441026346631075, "harm": 0.21301196053953844, "sub": 0.0, "sat": 4.766977419220539, "tick_db": -21.287769785072523, "tick_f": 1382.511413847431, "tick_bw": 2.718274615476428, "tick_ms": 32.52771141390576, "glass": 0.0, "air_db": -52.356980461115846, "air_tilt": -0.3151428303795978, "glass_f": 2107.88775714368, "dbl": 0.0, "dbl_dt": 0.06635422811163527, "dbl_ratio": 0.9084540157091213, "width": 0.05202448298139207, "knock": 0.395961088441888, "knock_f": 713.4633749925524, "tick_width": 0.9638675297752, "hp": 61.20518051449853, "lp": 6230.3560273382955, "length": 0.13287890570443392, "release_ms": 21.84916242441865, "contact_db": -9.647517911040923, "contact_ms": 1.0104839357018622, "contact_f": 1416.0012831332408, "ring_db": -27.05485536379517, "ring_ms": 27.963294467319635, "contact_lp_x": 0.0}, "seed": 929832608, "peak_db": -1.0, "gain_db": -1.57, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0055, "end_s": 0.103, "dur_s": 0.1349, "lufs_m_max": -22.21, "attack_ms": 1.25, "centroid_hz": 227.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -34.5, -48.8]}}},
"tap/knuckle": {"type": "forge", "category": "tap", "member": "knuckle", "recipe": "popin", "fn": "render", "params": {"body_f": 149.99999999999997, "drop": 0.35, "att_ms": 1.6000000000000003, "hold_ms": 1.4999999999999998, "sag_db": 0.0, "rel_ms": 4.5, "harm": 0.12, "sub": 0.12, "sat": 2.0, "tick_db": -17.0, "tick_f": 3499.9999999999995, "tick_bw": 2.5, "tick_ms": 12.0, "glass": 0.0, "air_db": -60.0, "air_tilt": 0.0, "glass_f": 3200.0000000000027, "dbl": 0.0, "dbl_dt": 0.065, "dbl_ratio": 1.0, "width": 0.3, "knock": 0.1, "knock_f": 499.99999999999983, "tick_width": 0.6, "hp": 55.0, "lp": 9000.000000000004, "length": 0.15, "release_ms": 15.0, "contact_db": -2.0, "contact_ms": 0.8, "contact_f": 2499.9999999999995, "ring_db": -24.0, "ring_ms": 40.0, "contact_lp_x": 0.0}, "seed": 1826701615, "peak_db": -1.0, "gain_db": -2.69, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0055, "end_s": 0.13, "dur_s": 0.152, "lufs_m_max": -21.09, "attack_ms": 4.25, "centroid_hz": 278.6, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -28.7, -39.7]}}},
"tap/soft": {"type": "forge", "category": "tap", "member": "soft", "recipe": "popin", "fn": "render", "params": {"body_f": 91.04955879305285, "drop": 0.0507952753478228, "att_ms": 2.458168897165832, "hold_ms": 3.0791880099196125, "sag_db": 9.986939094810708, "rel_ms": 6.059491413639858, "harm": 0.0056482458089304015, "sub": 0.12, "sat": 6.5876754515005755, "tick_db": -20.510473832471476, "tick_f": 7558.072609648025, "tick_bw": 1.9397733308255607, "tick_ms": 5.164125754366953, "glass": 0.0, "air_db": -31.533442465367536, "air_tilt": 0.5257648493595857, "glass_f": 2433.9621552547624, "dbl": 0.0, "dbl_dt": 0.06577528117880124, "dbl_ratio": 1.0508303976898885, "width": 0.06, "knock": 0.15490560135812428, "knock_f": 542.2962499218237, "tick_width": 0.5, "hp": 55.0, "lp": 11993.547058082966, "length": 0.128433, "release_ms": 9.292146740116927, "contact_db": -8.350407677588136, "contact_ms": 1.5927357512192841, "contact_f": 1603.995305444424, "ring_db": -22, "ring_ms": 24.41111, "contact_lp_x": 0.0}, "seed": 575199001, "peak_db": -1.0, "gain_db": -2.48, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0055, "end_s": 0.096, "dur_s": 0.1304, "lufs_m_max": -21.3, "attack_ms": 1.25, "centroid_hz": 163.4, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -31.7, -49.3]}}},
- "toggle/on": {"type": "forge", "category": "toggle", "member": "on", "recipe": "toggle", "fn": "render", "params": {"gap": 0.054424601537825155, "dir": 1.3395047531861033, "a_lvl": 2.1468610609823426, "pitch": 2952.9284269099794, "bright": 0.8661783143054866, "snap_ms": 0.6933779484558114, "tone": 0.312692438620615, "partials": 2, "inharm": 2.0950561496769327, "tink_ms": 2.0459715487265653, "body": 0.0659301225751319, "body_f": 656.4958207356074, "body_ms": 2.6991933498077896, "body_drop": 0.06063190277625063, "grit": 0.1372586902449464, "grit_ms": 30.000000000000004, "slide": 0.11879895868497142, "slide_f": 1566.976442384132, "spring": 0.004717722953869387, "spring_f": 3940.1616425828515, "room": 0.02618470978311251, "verb": 0.1565044644278678, "rt": 0.10272889680295971, "hp": 247.10503987530353, "lp": 10225.552690475275, "deharsh": 1.5060499503782092, "deharsh_f": 2741.0319958024365, "sat": 6.9575556718047125, "attack_ms": 0.11691650073087113, "tail": 0.1141042002323436, "release_ms": 6.006336151015257, "width": 0.07173901453738522, "hp_steep": 1}, "seed": 198682238, "peak_db": -1.0, "gain_db": -7.34, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.103, "dur_s": 0.1666, "lufs_m_max": -18.26, "attack_ms": 0.5, "centroid_hz": 3757.7, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -5.4, -50.6]}}},
- "toggle/off": {"type": "forge", "category": "toggle", "member": "off", "recipe": "toggle", "fn": "render", "params": {"gap": 0.05715142448477326, "dir": 0.7294053470087549, "a_lvl": 2.2190582148898703, "pitch": 3281.8764502505555, "bright": 0.5993729170256712, "snap_ms": 0.5998226511692046, "tone": 0.39124488946605074, "partials": 2, "inharm": 2.2461001144799186, "tink_ms": 2.9178624731949134, "body": 0.024681636579278105, "body_f": 566.5921330095961, "body_ms": 3.2751037379538386, "body_drop": 0.32206518693643904, "grit": 0.19737183687707555, "grit_ms": 25.117203002734197, "slide": 0.11732100630831638, "slide_f": 6942.169066069528, "spring": 0.027879875540157514, "spring_f": 4982.175113228577, "room": 0.10807742390975869, "verb": 0.15593653554061193, "rt": 0.1833482424446305, "hp": 233.29083837862754, "lp": 11322.242656368599, "deharsh": 0.3222127763583478, "deharsh_f": 4135.151638504453, "sat": 1.2891320932533956, "attack_ms": 0.1707408585078054, "tail": 0.07625313119102282, "release_ms": 25.10846536341947, "width": 0.18592375224772195, "hp_steep": 1}, "seed": 1995665369, "peak_db": -1.0, "gain_db": -4.47, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.121, "dur_s": 0.1365, "lufs_m_max": -21.13, "attack_ms": 0.5, "centroid_hz": 3862.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -4.0, -38.4]}}},
- "toggle/latch": {"type": "forge", "category": "toggle", "member": "latch", "recipe": "toggle", "fn": "render", "params": {"gap": 0.13479934891177464, "dir": 1.45, "a_lvl": 2.041999871245778, "pitch": 2380.061108549831, "bright": 0.6538616446461357, "snap_ms": 0.15276581784981288, "tone": 0.2980611438169422, "partials": 2, "inharm": 1.763976639582702, "tink_ms": 1.5993602287347213, "body": 0.051866711992314365, "body_f": 342.6926844193687, "body_ms": 2.759069065947455, "body_drop": 0.05311434648926628, "grit": 0.024737132822930403, "grit_ms": 27.956580932232598, "slide": 0.04942777457982873, "slide_f": 2012.9579087972793, "spring": 0.052640766248523235, "spring_f": 5999.999999999995, "room": 0.026231343774978873, "verb": 0.050060232032805935, "rt": 0.10504162810758566, "hp": 243.82706606482375, "lp": 10660.00053905828, "deharsh": 1.5086696610113777, "deharsh_f": 2626.8239782520054, "sat": 3.2020765762144965, "attack_ms": 0.24791331493477264, "tail": 0.0806089994992347, "release_ms": 11.548914643807981, "width": 0.14760360532031896, "hp_steep": 1}, "seed": 98727163, "peak_db": -1.0, "gain_db": -2.81, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.1385, "end_s": 0.177, "dur_s": 0.217, "lufs_m_max": -22.79, "attack_ms": 0.5, "centroid_hz": 3847.9, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-0.4, -21.4, 0.0, -34.2]}}},
- "toggle/micro": {"type": "forge", "category": "toggle", "member": "micro", "recipe": "toggle", "fn": "render", "params": {"gap": 0.025266813917762854, "dir": 0.9505957038840421, "a_lvl": 1.8953722867159255, "pitch": 3733.4908420652578, "bright": 0.7404809251174879, "snap_ms": 0.2166073919898852, "tone": 0.055199898414619857, "partials": 1, "inharm": 2.3169403668783985, "tink_ms": 2.298485650238084, "body": 0.029184208437519038, "body_f": 886.1415608632302, "body_ms": 4.0, "body_drop": 0.3120582502405165, "grit": 0.5359605349884788, "grit_ms": 2.005283992336778, "slide": 0.0, "slide_f": 1917.42874938384, "spring": 0.0, "spring_f": 5203.588653518337, "room": 0.028791883620793456, "verb": 0.10483736277125344, "rt": 0.0705679334739563, "hp": 347.0404169675962, "lp": 11044.44762654069, "deharsh": 3.8656800777025646, "deharsh_f": 3011.7834496005726, "sat": 7.315643838490821, "attack_ms": 0.0854298518526112, "tail": 0.09474056386556601, "release_ms": 19.489731020545644, "width": 0.15873184884552627, "hp_steep": 1}, "seed": 460490113, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.066, "dur_s": 0.1234, "lufs_m_max": -25.6, "attack_ms": 0.5, "centroid_hz": 6675.5, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -42.7]}}},
- "toggle/rocker": {"type": "forge", "category": "toggle", "member": "rocker", "recipe": "toggle", "fn": "render", "params": {"hp_steep": 0, "gap": 0.08118793117947579, "dir": 0.7858689004133377, "a_lvl": 0.5720161239994717, "pitch": 2801.383561383881, "bright": 0.10058592140222733, "snap_ms": 0.251881716644462, "tone": 0.4107010194466384, "partials": 3, "inharm": 2.7412036063418026, "tink_ms": 1.8259479832747458, "body": 0.06561413163319935, "body_f": 478.66083404733376, "body_ms": 5.4105824904483235, "body_drop": 0.181247549843429, "grit": 0.02840184970618169, "grit_ms": 2.9648337600130055, "slide": 0.06166508366216897, "slide_f": 3160.8334562675973, "spring": 0.03306115222392345, "spring_f": 3652.712995777809, "room": 0.0788817382408891, "verb": 0.08169561871948361, "rt": 0.267233510121214, "hp": 88.79394207168949, "lp": 10043.135120058743, "deharsh": 1.8459257991625497, "deharsh_f": 3006.74271479676, "sat": 7.95341027533584, "attack_ms": 1.4784623111544104, "tail": 0.1542616986966496, "release_ms": 7.198251980602585, "width": 0.1809159882059402}, "seed": 2134948140, "peak_db": -1.0, "gain_db": -6.43, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0825, "end_s": 0.16, "dur_s": 0.2348, "lufs_m_max": -19.17, "attack_ms": 0.75, "centroid_hz": 2515.7, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-3.9, 0.0, -25.2, -43.2]}}},
+ "toggle/on": {"type": "forge", "category": "toggle", "member": "on", "recipe": "toggle", "fn": "render", "params": {"gap": 0.054424601537825155, "dir": 1.3395047531861033, "a_lvl": 2.1468610609823426, "pitch": 2952.9284269099794, "bright": 0.8661783143054866, "snap_ms": 0.6933779484558114, "tone": 0.312692438620615, "partials": 2, "inharm": 2.0950561496769327, "tink_ms": 2.0459715487265653, "body": 0.0659301225751319, "body_f": 656.4958207356074, "body_ms": 2.6991933498077896, "body_drop": 0.06063190277625063, "grit": 0.1372586902449464, "grit_ms": 30.000000000000004, "slide": 0.11879895868497142, "slide_f": 1566.976442384132, "spring": 0.004717722953869387, "spring_f": 3940.1616425828515, "room": 0.02618470978311251, "verb": 0.1565044644278678, "rt": 0.10272889680295971, "hp": 247.10503987530353, "lp": 10225.552690475275, "deharsh": 1.5060499503782092, "deharsh_f": 2741.0319958024365, "sat": 6.9575556718047125, "attack_ms": 0.11691650073087113, "tail": 0.1141042002323436, "release_ms": 6.006336151015257, "width": 0.07173901453738522, "hp_steep": 1}, "seed": 198682238, "peak_db": -1.0, "gain_db": -7.34, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.103, "dur_s": 0.1666, "lufs_m_max": -18.26, "attack_ms": 0.5, "centroid_hz": 3757.7, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -5.4, -50.6]}, "pitch_hz": 3935.05}},
+ "toggle/off": {"type": "forge", "category": "toggle", "member": "off", "recipe": "toggle", "fn": "render", "params": {"gap": 0.05715142448477326, "dir": 0.7294053470087549, "a_lvl": 2.2190582148898703, "pitch": 3281.8764502505555, "bright": 0.5993729170256712, "snap_ms": 0.5998226511692046, "tone": 0.39124488946605074, "partials": 2, "inharm": 2.2461001144799186, "tink_ms": 2.9178624731949134, "body": 0.024681636579278105, "body_f": 566.5921330095961, "body_ms": 3.2751037379538386, "body_drop": 0.32206518693643904, "grit": 0.19737183687707555, "grit_ms": 25.117203002734197, "slide": 0.11732100630831638, "slide_f": 6942.169066069528, "spring": 0.027879875540157514, "spring_f": 4982.175113228577, "room": 0.10807742390975869, "verb": 0.15593653554061193, "rt": 0.1833482424446305, "hp": 233.29083837862754, "lp": 11322.242656368599, "deharsh": 0.3222127763583478, "deharsh_f": 4135.151638504453, "sat": 1.2891320932533956, "attack_ms": 0.1707408585078054, "tail": 0.07625313119102282, "release_ms": 25.10846536341947, "width": 0.18592375224772195, "hp_steep": 1}, "seed": 1995665369, "peak_db": -1.0, "gain_db": -4.47, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.121, "dur_s": 0.1365, "lufs_m_max": -21.13, "attack_ms": 0.5, "centroid_hz": 3862.1, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -4.0, -38.4]}, "pitch_hz": 2382.64}},
+ "toggle/latch": {"type": "forge", "category": "toggle", "member": "latch", "recipe": "toggle", "fn": "render", "params": {"gap": 0.13479934891177464, "dir": 1.45, "a_lvl": 2.041999871245778, "pitch": 2380.061108549831, "bright": 0.6538616446461357, "snap_ms": 0.15276581784981288, "tone": 0.2980611438169422, "partials": 2, "inharm": 1.763976639582702, "tink_ms": 1.5993602287347213, "body": 0.051866711992314365, "body_f": 342.6926844193687, "body_ms": 2.759069065947455, "body_drop": 0.05311434648926628, "grit": 0.024737132822930403, "grit_ms": 27.956580932232598, "slide": 0.04942777457982873, "slide_f": 2012.9579087972793, "spring": 0.052640766248523235, "spring_f": 5999.999999999995, "room": 0.026231343774978873, "verb": 0.050060232032805935, "rt": 0.10504162810758566, "hp": 243.82706606482375, "lp": 10660.00053905828, "deharsh": 1.5086696610113777, "deharsh_f": 2626.8239782520054, "sat": 3.2020765762144965, "attack_ms": 0.24791331493477264, "tail": 0.0806089994992347, "release_ms": 11.548914643807981, "width": 0.14760360532031896, "hp_steep": 1}, "seed": 98727163, "peak_db": -1.0, "gain_db": -2.81, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.1385, "end_s": 0.177, "dur_s": 0.217, "lufs_m_max": -22.79, "attack_ms": 0.5, "centroid_hz": 3847.9, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-0.4, -21.4, 0.0, -34.2]}, "pitch_hz": 3369.76}},
+ "toggle/micro": {"type": "forge", "category": "toggle", "member": "micro", "recipe": "toggle", "fn": "render", "params": {"gap": 0.025266813917762854, "dir": 0.9505957038840421, "a_lvl": 1.8953722867159255, "pitch": 3733.4908420652578, "bright": 0.7404809251174879, "snap_ms": 0.2166073919898852, "tone": 0.055199898414619857, "partials": 1, "inharm": 2.3169403668783985, "tink_ms": 2.298485650238084, "body": 0.029184208437519038, "body_f": 886.1415608632302, "body_ms": 4.0, "body_drop": 0.3120582502405165, "grit": 0.5359605349884788, "grit_ms": 2.005283992336778, "slide": 0.0, "slide_f": 1917.42874938384, "spring": 0.0, "spring_f": 5203.588653518337, "room": 0.028791883620793456, "verb": 0.10483736277125344, "rt": 0.0705679334739563, "hp": 347.0404169675962, "lp": 11044.44762654069, "deharsh": 3.8656800777025646, "deharsh_f": 3011.7834496005726, "sat": 7.315643838490821, "attack_ms": 0.0854298518526112, "tail": 0.09474056386556601, "release_ms": 19.489731020545644, "width": 0.15873184884552627, "hp_steep": 1}, "seed": 460490113, "peak_db": -1.0, "gain_db": 0.0, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0045, "end_s": 0.066, "dur_s": 0.1234, "lufs_m_max": -25.6, "attack_ms": 0.5, "centroid_hz": 6675.5, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -42.7]}, "pitch_hz": null}},
+ "toggle/rocker": {"type": "forge", "category": "toggle", "member": "rocker", "recipe": "toggle", "fn": "render", "params": {"hp_steep": 0, "gap": 0.08118793117947579, "dir": 0.7858689004133377, "a_lvl": 0.5720161239994717, "pitch": 2801.383561383881, "bright": 0.10058592140222733, "snap_ms": 0.251881716644462, "tone": 0.4107010194466384, "partials": 3, "inharm": 2.7412036063418026, "tink_ms": 1.8259479832747458, "body": 0.06561413163319935, "body_f": 478.66083404733376, "body_ms": 5.4105824904483235, "body_drop": 0.181247549843429, "grit": 0.02840184970618169, "grit_ms": 2.9648337600130055, "slide": 0.06166508366216897, "slide_f": 3160.8334562675973, "spring": 0.03306115222392345, "spring_f": 3652.712995777809, "room": 0.0788817382408891, "verb": 0.08169561871948361, "rt": 0.267233510121214, "hp": 88.79394207168949, "lp": 10043.135120058743, "deharsh": 1.8459257991625497, "deharsh_f": 3006.74271479676, "sat": 7.95341027533584, "attack_ms": 1.4784623111544104, "tail": 0.1542616986966496, "release_ms": 7.198251980602585, "width": 0.1809159882059402}, "seed": 2134948140, "peak_db": -1.0, "gain_db": -6.43, "mode": "designed", "meta": {"onset_s": 0.0012, "peak_s": 0.0825, "end_s": 0.16, "dur_s": 0.2348, "lufs_m_max": -19.17, "attack_ms": 0.75, "centroid_hz": 2515.7, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [-3.9, 0.0, -25.2, -43.2]}, "pitch_hz": 2181.14}},
"typing_key/thock": {"type": "forge", "category": "typing_key", "member": "thock", "recipe": "keypress", "fn": "render", "params": {"click_tc": 0.00010992131235288892, "click_tau": 0.000354895278033054, "click_lvl": 0.33036327916282276, "click_lo": 7429.487051948839, "click_tilt": -1.8741989655297304, "crack": 0.2400793477786361, "snap": 0.0, "cap_f": 1079.6414192216064, "cap_tau": 0.0045, "cap_noise": 1.0, "cap_n": 6, "cap_cl": 0.5040816100875709, "cap_fast": 0.0005737386327755772, "cap_res": 0.40280281672793683, "mid_f": 181.88617731536064, "mid_tau": 0.008381336671471805, "mid_lvl": 0.1232146681505418, "thock_f": 88.39488005556333, "thock_tau": 0.045000000000000005, "thock_lvl": 0.05000000000000001, "thock_rise": 0.017761869877211556, "case_f": 70.00000000000003, "case_lvl": 0.5311621327932016, "case_dec": 0.7451133361361371, "up_delay": 0.125, "up_lvl": 0.07999999999999999, "up_pitch": 1.0260477443019311, "tick_lvl": 0.661818906668882, "tick_dt": 0.016292606948578477, "pre_len": 0.0077320030139882544, "pre_lvl": 0.05396642081494907, "ping_f": 8331.121896880908, "ping_tau": 0.004759606418511122, "ping_lvl": 0.09578534762431194, "room_wet": 0.27547382046518004, "rt60": 0.10739196875517354, "room_size": 0.22737895012129394, "room_damp": 0.95, "room_model": "sparse", "floor_db": -62.80274505684173, "rumble": 0.3305792107391855, "clip": 0.2994481594532705, "hpf": 45.92972135044704, "key": 795, "top_lvl": 0.841891334674212, "top_lo": 2202.8073360613703, "top_tau": 0.0018916366829502948, "jacket_lvl": 0.0, "jacket_dt": 0.0071294727182575025, "pre_gap": 0.002482508967011157, "width": 0.2}, "seed": 1826701615, "peak_db": -1.0, "gain_db": 0.0, "mode": "real", "meta": {"onset_s": 0.0088, "peak_s": 0.0135, "end_s": 0.292, "dur_s": 0.3365, "lufs_m_max": -24.34, "attack_ms": 0.75, "centroid_hz": 3425.2, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -16.2, -21.6, -37.2, -44.4, -43.6, -51.9]}}},
"typing_key/crisp": {"type": "forge", "category": "typing_key", "member": "crisp", "recipe": "keypress", "fn": "render", "params": {"click_tc": 0.00010992131235288892, "click_tau": 0.000354895278033054, "click_lvl": 1.2999999999999998, "click_lo": 7429.487051948839, "click_tilt": -1.8741989655297304, "crack": 0.2400793477786361, "snap": 0.0, "cap_f": 1079.6414192216064, "cap_tau": 0.0045, "cap_noise": 1.0, "cap_n": 6, "cap_cl": 0.5040816100875709, "cap_fast": 0.0005737386327755772, "cap_res": 0.40280281672793683, "mid_f": 181.88617731536064, "mid_tau": 0.008381336671471805, "mid_lvl": 0.1232146681505418, "thock_f": 88.39488005556333, "thock_tau": 0.045000000000000005, "thock_lvl": 0.055, "thock_rise": 0.017761869877211556, "case_f": 70.00000000000003, "case_lvl": 0.5311621327932016, "case_dec": 0.7451133361361371, "up_delay": 0.125, "up_lvl": 0.07999999999999999, "up_pitch": 1.0260477443019311, "tick_lvl": 0.661818906668882, "tick_dt": 0.016292606948578477, "pre_len": 0.0077320030139882544, "pre_lvl": 0.05396642081494907, "ping_f": 8331.121896880908, "ping_tau": 0.004759606418511122, "ping_lvl": 0.22, "room_wet": 0.27547382046518004, "rt60": 0.10739196875517354, "room_size": 0.22737895012129394, "room_damp": 0.95, "room_model": "sparse", "floor_db": -70.0, "rumble": 0.3305792107391855, "clip": 0.22, "hpf": 45.92972135044704, "key": 321, "top_lvl": 2.2, "top_lo": 2202.8073360613703, "top_tau": 0.0018916366829502948, "jacket_lvl": 0.0, "jacket_dt": 0.0071294727182575025, "pre_gap": 0.002482508967011157, "width": 0.2}, "seed": 1367864807, "peak_db": -1.0, "gain_db": 0.0, "mode": "real", "meta": {"onset_s": 0.0088, "peak_s": 0.0115, "end_s": 0.202, "dur_s": 0.2231, "lufs_m_max": -25.95, "attack_ms": 1.0, "centroid_hz": 3590.8, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -12.4, -20.7, -32.4, -53.1]}}},
"typing_key/clicky": {"type": "forge", "category": "typing_key", "member": "clicky", "recipe": "keypress", "fn": "render", "params": {"click_tc": 0.00010992131235288892, "click_tau": 0.000354895278033054, "click_lvl": 0.33036327916282276, "click_lo": 7429.487051948839, "click_tilt": -1.8741989655297304, "crack": 0.2400793477786361, "snap": 0.0, "cap_f": 1649.9999999999998, "cap_tau": 0.0045, "cap_noise": 1.0, "cap_n": 6, "cap_cl": 0.5040816100875709, "cap_fast": 0.0005737386327755772, "cap_res": 0.40280281672793683, "mid_f": 181.88617731536064, "mid_tau": 0.008381336671471805, "mid_lvl": 0.1232146681505418, "thock_f": 88.39488005556333, "thock_tau": 0.045000000000000005, "thock_lvl": 0.05000000000000001, "thock_rise": 0.017761869877211556, "case_f": 70.00000000000003, "case_lvl": 0.5311621327932016, "case_dec": 0.7451133361361371, "up_delay": 0.125, "up_lvl": 0.07999999999999999, "up_pitch": 1.0260477443019311, "tick_lvl": 0.661818906668882, "tick_dt": 0.016292606948578477, "pre_len": 0.0077320030139882544, "pre_lvl": 0.05396642081494907, "ping_f": 8331.121896880908, "ping_tau": 0.004759606418511122, "ping_lvl": 0.09578534762431194, "room_wet": 0.27547382046518004, "rt60": 0.10739196875517354, "room_size": 0.22737895012129394, "room_damp": 0.95, "room_model": "sparse", "floor_db": -62.80274505684173, "rumble": 0.3305792107391855, "clip": 0.19, "hpf": 45.92972135044704, "key": 123, "top_lvl": 1.6, "top_lo": 2202.8073360613703, "top_tau": 0.0018916366829502948, "jacket_lvl": 0.55, "jacket_dt": 0.009, "pre_gap": 0.002482508967011157, "width": 0.2}, "seed": 1097657232, "peak_db": -1.0, "gain_db": 0.0, "mode": "real", "meta": {"onset_s": 0.0105, "peak_s": 0.0225, "end_s": 0.181, "dur_s": 0.1937, "lufs_m_max": -24.34, "attack_ms": 0.75, "centroid_hz": 4234.7, "channels": 2, "fp": {"hop_s": 0.05, "env_db": [0.0, -12.8, -20.3, -31.6]}}},
diff --git a/earshot/forge/kit.py b/earshot/forge/kit.py
index c8ef278..b323baa 100644
--- a/earshot/forge/kit.py
+++ b/earshot/forge/kit.py
@@ -23,12 +23,15 @@ kit.json (schema 1):
so take 1 is the delivered final). A take that fails the audit is rendered again on seed + 1000 j (up to
REROLL times) and the first clean one kept (the lock names it, with planned_seed). Same kit, same takes:
rendering is deterministic.
- edits knobs for every take: dur, apex, pitch, peak_db (default -1), weight (earshot.forge.knobs, bank.render)
- pitches one set of takes per pitch (note names or Hz), through the recipe's own pitch parameter
+ edits knobs for every take: dur, apex, pitch, peak_db (default -1, at most 0), weight (earshot.forge.knobs,
+ bank.render); checked like a render checks them (a whoosh-only apex, a pitch the sound cannot take)
+ pitches one set of takes per pitch (note names, 'Cs5' sharps included, or Hz), through the recipe's own pitch
+ parameter; two spellings of one pitch ('C#5', 'Db5', 554.37) are one take, so a list may not repeat one
align the sync point a mixer puts on the cue: onset (the take's measured onset), peak (its loudest 5 ms: whoosh
apexes), end (its end: risers, swells); default ALIGN[role]
- max_s a take longer than this is faded out to it (a quarter of the length, at most 150 ms)
- level_db the mix level of the role relative to a take at its peak: information for the mixer (audition uses it)
+ max_s a take longer than this is faded out to it (a quarter of the length, at most 150 ms); 0.01 s or more
+ level_db the mix level of the role relative to a take at its peak: information for the mixer (audition uses it); a
+ number (leave it out for 0)
note why this sound (the presets say why for every role; "off" says why a role is null)
null the role is not sounded: a renderer skips such cues (the presets keep riser, swell and suck off)
@@ -40,13 +43,17 @@ kit.lock.json (written by render into --out with the takes):
"key": "...", "checks": []}]},
"riser": null}}
Takes are 24-bit WAVs named <role>_<k>.wav (dots in a role become '-': tick-crisp_1.wav) or <role>_<pitch>[_k].wav
-(C#5 -> Cs5). The cache: a take whose key (bank entry, seed, pitch, edits, max_s, sr, bank version, earshot
-version) and file hash match the existing lock is kept as it is; --force renders everything; files of the old lock
+with one canonical label per pitch (knobs.label: C#5 / Db5 / 554.37 -> Cs5, 445 -> 445hz). Names must differ also
+without regard to case (Windows and macOS file systems): a kit whose takes would share a file is refused. The
+cache: a take whose key (bank entry, seed, pitch, edits, max_s, sr, bank version, earshot version) and file hash
+match the existing lock is kept as it is; --force renders everything; files of the old lock
that the new kit no longer names are removed (only those). `checks` lists the warning codes of the take's audit
-(earshot.forge.sfx.check with the role as context: a hit warns on stacked attacks and pre-swells).
+(earshot.forge.sfx.check with the role as context: a hit warns on stacked attacks and pre-swells; a pitch knob that
+missed its note by more than 50 cents adds pitch_off).
"""
import hashlib
import json
+import math
import os
import re
import time
@@ -109,14 +116,21 @@ def load(kit):
return kit
+def _is_num(v):
+ return isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(v)
+
+
def problems(kit):
- """what is wrong with a kit dict (schema, roles, ids, knob names); [] when it is valid"""
+ """what is wrong with a kit dict: schema, roles, ids, keys, and every value a render would refuse (knob ranges,
+ pitches the sound cannot take, levels over 0 dBFS, take files that would collide); [] when it is valid"""
from . import bank
out = []
if not isinstance(kit, dict) or kit.get('kit') != SCHEMA:
return [f'not a kit file (needs "kit": {SCHEMA})']
- if int(kit.get('sr', SR)) not in (44100, 48000, 88200, 96000):
- out.append(f"sr {kit.get('sr')}: use 48000 (or 44100 / 88200 / 96000)")
+ try:
+ bank.check_sr(kit.get('sr', SR))
+ except bank.BankError:
+ out.append(f"sr {kit.get('sr')!r}: use 48000 (or 44100 / 88200 / 96000)")
roles = kit.get('roles')
if not isinstance(roles, dict) or not roles:
return out + ['roles: a non-empty object {role: spec | null}']
@@ -142,22 +156,97 @@ def problems(kit):
out.append(f'{role}: takes must be an integer 1-{MAX_TAKES}')
if spec.get('seed') is not None and (not isinstance(spec['seed'], int) or isinstance(spec['seed'], bool)):
out.append(f'{role}: seed must be an integer')
- ed = spec.get('edits') or {}
+ ed = spec.get('edits') if spec.get('edits') is not None else {}
if not isinstance(ed, dict) or set(ed) - set(EDITS):
out.append(f'{role}: edits takes {", ".join(EDITS)}')
+ ed = {}
ps = spec.get('pitches')
if ps is not None and (not isinstance(ps, list) or not ps):
out.append(f'{role}: pitches must be a non-empty list of notes / Hz')
- if ps and isinstance(ed, dict) and ed.get('pitch') is not None:
+ ps = None
+ if ps and ed.get('pitch') is not None:
out.append(f'{role}: give edits.pitch or pitches, not both')
if spec.get('align', ALIGN.get(role, 'onset')) not in ALIGNS:
out.append(f'{role}: align must be one of {", ".join(ALIGNS)}')
- for k in ('max_s', 'level_db'):
- if spec.get(k) is not None and not isinstance(spec[k], (int, float)):
- out.append(f'{role}: {k} must be a number')
+ if 'level_db' in spec and not _is_num(spec['level_db']):
+ out.append(f"{role}: level_db must be a number (leave it out for 0 dB), got {spec['level_db']!r}")
+ if spec.get('max_s') is not None and (not _is_num(spec['max_s']) or spec['max_s'] < 0.01):
+ out.append(f"{role}: max_s must be a number of seconds, 0.01 or more (a shorter take is silence), got "
+ f"{spec['max_s']!r}")
+ out += _edit_problems(role, sid if sid in known else None, ed, ps)
+ out += _name_problems(kit)
+ return out
+
+
+def _edit_problems(role, sid, ed, ps):
+ """the knob values of one role that a render would refuse (the same checks: bank.level, knobs.validate)"""
+ from . import bank, knobs
+ out = []
+ try:
+ bank.level(ed.get('peak_db', -1.0), ed.get('weight'))
+ except bank.BankError as e:
+ out.append(f'{role}: {e}')
+ for k in ('dur', 'apex'):
+ if ed.get(k) is not None and not _is_num(ed[k]):
+ out.append(f'{role}: edits.{k} must be a number of seconds, got {ed[k]!r}')
+ return out
+ if sid is None:
+ return out
+ e = bank.get(sid)
+ try:
+ knobs.validate(e, dur=ed.get('dur'), apex=ed.get('apex'))
+ except knobs.KnobError as x:
+ out.append(f'{role}: {x}')
+ for p in (ps or [ed.get('pitch')]):
+ if p is None:
+ continue
+ try:
+ knobs.validate(e, pitch=p)
+ except knobs.KnobError as x:
+ out.append(f'{role}: pitch {p!r}: {x}')
+ return out
+
+
+def _take_names(kit):
+ """[(role, file name, pitch)] of every take a kit would write, for the specs whose pitches all parse (plan's
+ naming)"""
+ from . import knobs
+ out = []
+ for role, spec in (kit.get('roles') or {}).items():
+ if not isinstance(spec, dict) or not isinstance(role, str):
+ continue
+ n = spec.get('takes', 1)
+ n = n if isinstance(n, int) and not isinstance(n, bool) and 1 <= n <= MAX_TAKES else 1
+ ps = spec.get('pitches') if isinstance(spec.get('pitches'), list) and spec.get('pitches') else None
+ try:
+ labels = [knobs.label(p) for p in ps] if ps else [None]
+ except knobs.KnobError:
+ continue
+ stem = role.replace('.', '-')
+ for p, lb in zip(ps or [None], labels):
+ for k in range(1, n + 1):
+ f = stem + (f'_{lb}' if lb else '') + (f'_{k}' if (n > 1 or not ps) else '') + '.wav'
+ out.append((role, f, p))
return out
+def _name_problems(kit):
+ """take files that would share a name, compared without regard to case (Windows / macOS file systems)"""
+ seen, out = {}, []
+ for role, f, p in _take_names(kit):
+ key = f.lower()
+ if key not in seen:
+ seen[key] = (role, f, p)
+ continue
+ r0, f0, p0 = seen[key]
+ if r0 == role and p is not None:
+ out.append(f'{role}: pitches {p0!r} and {p!r} are one pitch ({f}): list each pitch once')
+ else:
+ out.append(f'{role}: take file {f} is also {f0} of role {r0} on a case-insensitive file system: rename '
+ 'the role')
+ return sorted(set(out), key=out.index)
+
+
def init(preset_name='calm', out='audio/kit.json', force=False):
"""write a preset as a film's kit file: {'summary', 'file', 'kit'}"""
k = preset(preset_name)
@@ -174,16 +263,17 @@ def init(preset_name='calm', out='audio/kit.json', force=False):
# ------------------------------------------------------------------------------------------------------- planning
def _label(p):
- from .knobs import midi
- s = str(p).strip()
- if midi(s) is not None:
- return s.replace('#', 's')
- return re.sub(r'[^0-9a-zA-Z.]+', '', s.lower().replace('hz', '')) + 'hz'
+ from .knobs import label
+ return label(p)
def plan(kit):
- """the takes a kit renders: [{role, file, sound, seed, pitch, edits, max_s, k}]"""
+ """the takes a kit renders: [{role, file, sound, seed, pitch, edits, max_s, k}]. KitError when two takes would
+ share a file (case-insensitively)"""
from . import bank
+ dup = _name_problems(kit)
+ if dup:
+ raise KitError('invalid kit: ' + '; '.join(dup))
out = []
for role, spec in kit['roles'].items():
if not spec:
@@ -230,6 +320,7 @@ def _render_one(t, seed, role):
if t['max_s'] and len(y) > t['max_s'] * SR:
y = knobs.fit_length(y, float(t['max_s']))[0].astype(np.float32)
c = sfx.check(y, category=bank.get(t['sound'])['category'], role=role or t['role'], sound=t['sound'])
+ bank.add_warning(c, knobs.pitch_warning(meta.get('edits')))
return y, c, meta
@@ -279,7 +370,7 @@ def render(kit, out, force=False, log=None):
for role, spec in k['roles'].items():
lock['roles'][role] = None if not spec else {
'sound': spec['sound'], 'align': spec.get('align', ALIGN.get(role, 'onset')),
- 'level_db': float(spec.get('level_db', 0.0)), 'max_s': spec.get('max_s'), 'takes': []}
+ 'level_db': float(spec.get('level_db') or 0.0), 'max_s': spec.get('max_s'), 'takes': []}
rendered = cached = 0
for t in plan(k):
key = take_key(t, sr)
@@ -372,6 +463,9 @@ def check(kit, out=None, log=None):
if tk and os.path.isfile(os.path.join(out, tk['file'])):
c = sfx.check(os.path.join(out, tk['file']), category=bank.get(t['sound'])['category'],
role=t['role'], sound=t['sound'])
+ if 'pitch_off' in (tk.get('checks') or []): # measured at render (the file does not say)
+ bank.add_warning(c, {'code': 'pitch_off', 'msg': f"pitch {t['pitch']}: the knob did not land "
+ 'the note (kit.lock.json)'})
row['source'] = 'rendered file'
else:
_, c, _, used = render_take(t)
diff --git a/earshot/forge/kits/calm.json b/earshot/forge/kits/calm.json
index 2a1621e..23d8d86 100644
--- a/earshot/forge/kits/calm.json
+++ b/earshot/forge/kits/calm.json
@@ -38,10 +38,10 @@
"snap": {"sound": "fit/snap/switch_flip", "takes": 2, "align": "onset", "level_db": -3.5,
"note": "a switch flip, a CC0 recording fitted as code (0.19 s, one attack): matches 'a toggle switch click' at z +2.24, p 1.00 over synth-blip descriptions (pro_pop_in/knock: +0.61, 0.27), realness 0.97 (0.08)"},
"swell": null,
- "bell": {"sound": "pluck/kalimba", "pitches": ["C5", "D5", "E5", "G5", "A5"], "takes": 1, "align": "onset", "level_db": -5.0,
- "note": "the launch film's kalimba on a C pentatonic: one tuned note per progress step or motif note"},
- "text": {"sound": "pluck/kalimba_soft", "pitches": ["C5", "E5", "G5"], "takes": 1, "align": "onset", "level_db": -12.0,
- "note": "one soft tuned note when a text fragment resolves (not per word), rotating through the chord, under the picture"}
+ "bell": {"sound": "pluck/kalimba", "pitches": ["G4", "A4", "C5", "D5", "E5", "G5", "A5", "C6", "D6", "E6"], "takes": 1, "align": "onset", "level_db": -5.0,
+ "note": "the launch film's kalimba on two octaves of a C pentatonic (G4-E6, 10 notes): one tuned note per progress step or motif note, so a climbing motif has a rung for every step"},
+ "text": {"sound": "pluck/kalimba_soft", "pitches": ["C5", "D5", "E5", "G5", "A5"], "takes": 1, "align": "onset", "level_db": -12.0,
+ "note": "one soft tuned note when a text fragment resolves (not per word), stepping through the chord's tones among the five pentatonic degrees of one octave, under the picture"}
},
"off": {
"suck": "off by default: a reverse whoosh into a cut stacks a build onto the reveal",
diff --git a/earshot/forge/kits/crisp.json b/earshot/forge/kits/crisp.json
index b845c5f..bbdcf42 100644
--- a/earshot/forge/kits/crisp.json
+++ b/earshot/forge/kits/crisp.json
@@ -39,10 +39,10 @@
"snap": {"sound": "fit/snap/switch_flip", "takes": 2, "align": "onset", "level_db": -6.5,
"note": "a switch flip, a CC0 recording fitted as code (0.19 s, one attack): matches 'a toggle switch click' at z +2.24, p 1.00 over synth-blip descriptions (toggle/latch, two attacks: +2.04, 0.97), realness 0.97 (0.50)"},
"swell": null,
- "bell": {"sound": "pluck/kalimba", "pitches": ["C5", "D5", "E5", "G5", "A5"], "takes": 1, "align": "onset", "level_db": -5.0,
- "note": "the tuned kalimba voice on a C pentatonic: progress steps and motifs"},
+ "bell": {"sound": "pluck/kalimba", "pitches": ["G4", "A4", "C5", "D5", "E5", "G5", "A5", "C6", "D6", "E6"], "takes": 1, "align": "onset", "level_db": -5.0,
+ "note": "the tuned kalimba voice on two octaves of a C pentatonic (G4-E6, 10 notes): progress steps and motifs, a rung for every step"},
"text": {"sound": "fit/land.light/finger_phone", "takes": 3, "align": "onset", "level_db": -5.0,
- "note": "a finger tapping a phone, a CC0 recording fitted as code (0.33 s, a low soft tap, untuned so it never fights the music): its top tag is 'a soft UI button tap'; realness 0.89 (pro_tap/soft, which it replaces, is a designed thump); level +7 dB for its lower loudness at the same peak (95 Hz centroid)"}
+ "note": "a finger tapping a phone, a CC0 recording fitted as code (0.33 s, a low soft tap, untuned so it never fights the music: a new take per fragment): its top tag is 'a soft UI button tap'; realness 0.89 (pro_tap/soft, which it replaces, is a designed thump); level +7 dB for its lower loudness at the same peak (95 Hz centroid)"}
},
"off": {
"suck": "off by default: a reverse whoosh into a cut stacks a build onto the reveal",
diff --git a/earshot/forge/kits/minimal.json b/earshot/forge/kits/minimal.json
index bfc06ae..3135ffe 100644
--- a/earshot/forge/kits/minimal.json
+++ b/earshot/forge/kits/minimal.json
@@ -39,10 +39,10 @@
"snap": {"sound": "fit/snap/switch_flip", "takes": 2, "align": "onset", "level_db": -3.5,
"note": "a switch flip, a CC0 recording fitted as code (0.19 s, one attack): matches 'a toggle switch click' at z +2.24, p 1.00 over synth-blip descriptions (pro_pop_in/knock: +0.61, 0.27), realness 0.97 (0.08)"},
"swell": null,
- "bell": {"sound": "pro_notify/ding_1822", "pitches": ["F6", "G6", "A6", "C7", "D7"], "takes": 1, "align": "onset", "level_db": -8.0,
- "note": "the clean ding on an F pentatonic around its own pitch (1822 Hz): sparse designed notes, no ringing bell"},
+ "bell": {"sound": "pro_notify/ding_1822", "pitches": ["A5", "C6", "D6", "F6", "G6", "A6", "C7", "D7", "F7", "G7"], "takes": 1, "align": "onset", "level_db": -8.0,
+ "note": "the clean ding on two octaves of an F pentatonic around its own pitch (1822 Hz; A5-G7, 10 notes): sparse designed notes, a rung for every progress step, no ringing bell"},
"text": {"sound": "fit/land.light/finger_phone", "takes": 3, "align": "onset", "level_db": -8.0,
- "note": "a finger tapping a phone, a CC0 recording fitted as code (0.33 s, a quiet low tap): its top tag is 'a soft UI button tap'; realness 0.89 (pro_tap/finger: 0.16); level +5 dB for its lower loudness at the same peak"}
+ "note": "a finger tapping a phone, a CC0 recording fitted as code (0.33 s, a quiet low tap, untuned so it never fights a note: a new take per fragment): its top tag is 'a soft UI button tap'; realness 0.89 (pro_tap/finger: 0.16); level +5 dB for its lower loudness at the same peak"}
},
"off": {
"suck": "off by default: a reverse whoosh into a cut stacks a build onto the reveal",
diff --git a/earshot/forge/knobs.py b/earshot/forge/knobs.py
index 18e52ec..facb43a 100644
--- a/earshot/forge/knobs.py
+++ b/earshot/forge/knobs.py
@@ -16,21 +16,29 @@ dur (s, the length of the file):
trim no length key (impact, toggle, typing_key, logo_sting, pluck: its file always holds 3 s of ring and room,
struck fits): the sound as it is
Every dur lands exactly: after the renders, a longer file is faded out to the length (a raised-cosine fade over a
- quarter of the length, 10-150 ms) and a shorter one is padded with silence; edits['dur'] says which and how much.
+ quarter of the length, 10-150 ms; with apex as well the fade starts at least APEX_KEEP after the apex) and a
+ shorter one is padded with silence; edits['dur'] says which and how much.
apex (s, the loudest 5 ms): the whoosh family only. The pass engine's peak is analytic, tp = rise * (|start_db| / 30)
** (1 / rise_k) (recipes/whoosh.py envelope()): rise is solved for the target, the render measured and rise corrected
by target / measured, at most MAX_FIX times, keeping the closest render; place_apex() then moves that render's peak
onto the target exactly (it trims the quiet approach, a head at least 20 dB under the peak, or pads silence before
it). Measured: the closed form lands within ~12 ms on the fast family, but the 5 ms peak of a broad fluttering pass
moves non-monotonically with rise (whoosh_big / pro_whoosh_big swell: +-50 ms for a 10 % change), so the search
- alone cannot promise APEX_TOL (5 ms); the placement does (edits['apex']: search_err_ms, fit, err_ms, ok).
-pitch ('C5', 'Eb6', 'F#4', 440, '440hz'): the note goes into the recipe's own pitch parameter (PITCH: the pluck's f0,
- a bell's head fundamental, a sub drop's landing pitch f1 with f0 keeping the glide ratio, a tap's body resonance
- with its knock and glass partials, a riser's tonal layer ...), the parameters of the same body scaled by the same
- ratio. The note must lie inside the parameter's designed range (the forge's search range, widened where the model
- allows it); noise sounds (whooshes, swishes, swipes, glitches, keys) and members whose tonal layer is off are refused
- with the reason. edits['pitch']['measured_hz'] = the strongest spectral peak near the target in the render (None
- when there is no clear one).
+ alone cannot promise APEX_TOL (5 ms); the placement does, in whole 1 ms steps of the peak measure. With dur as
+ well, the candidate renders are ranked on apex error plus tail-length error, and the apex is measured again on the
+ file after its fit to dur (edits['apex']: search_err_ms, fit, measured, err_ms, ok: what the delivered file does).
+pitch ('C5', 'Eb6', 'F#4' or 'Fs4', 440, '440hz'): the note goes into the recipe's own pitch parameter (PITCH: the
+ pluck's f0, a bell's head fundamental, a sub drop's landing pitch f1 with f0 keeping the glide ratio, a tap's body
+ resonance with its knock and glass partials, a riser's tonal layer ...), the parameters of the same body scaled by
+ the same ratio. The note must lie inside the parameter's designed range (the forge's search range, widened where the
+ model allows it); noise sounds (whooshes, swishes, swipes, glitches, keys) and members whose tonal layer is off are
+ refused with the reason. edits['pitch']['measured_hz'] = the strongest spectral peak near the target in the render
+ (None when there is no clear one), cents_off, and ok (within PITCH_TOL_CENTS; None where the sound is not measured:
+ risers, impacts); a take whose pitch is off carries a 'pitch_off' warning in its checks (pitch_warning()).
+ Clicks and toggles (click, pro_click, toggle): `pitch` is the centre of their tink partials and noise band, not the
+ partial you hear (click/soft: 2454 Hz, heard 2903 Hz). Their note is the measured partial (meta pitch_hz, measured
+ when the bank was built; null = no clear partial, so no pitch knob); a target is landed by measurement: the
+ parameter is scaled by target / heard, rendered, measured and corrected (at most MAX_FIX times), keeping the closest.
Level (peak_db, weight) is bank.render's, after the knobs.
"""
import re
@@ -39,6 +47,9 @@ import numpy as np
SR = 48000
APEX_TOL = 0.005 # s: the apex is met within this
+APEX_KEEP = 0.005 # s: the fade that fits a whoosh to dur starts at least this long after its apex
+PITCH_TOL_CENTS = 50 # a measured pitch within this of the target is ok
+PARTIAL_SPAN_ST = 6.0 # the heard partial of a click / toggle: the strongest peak within this of its `pitch`
DUR_REL = 0.01 # param / shape renders stop within 1 % of dur (or DUR_ABS); the fit to the sample is exact
DUR_ABS = 0.005
MAX_FIX = 2 # corrections after the first targeted render
@@ -55,14 +66,15 @@ LENGTH = {'riser': 'length', 'pro_riser': 'length', 'downlifter': 'length', 'sub
'notify': 'length', 'pro_notify': 'length', 'pro_typing_key': 'length'}
# category -> pitch spec: param (the note), co (scaled with it), range (Hz), needs (param, minimum: the tonal layer
-# must be on), measure ('start': the first 0.6 s, 'end': the last half, None: not measured), mode 'pc' = a pitch class
+# must be on), measure ('start': the first 0.6 s, 'end': the last half, None: not measured), mode 'pc' = a pitch class,
+# partial: the parameter is not the heard partial (module doc: clicks and toggles)
PITCH = {
'pluck': {'param': 'f0', 'range': (130.0, 2100.0)},
'notify': {'param': 'f0', 'range': (220.0, 3200.0)},
'pro_notify': {'param': 'f0', 'range': (600.0, 3200.0)},
- 'click': {'param': 'pitch', 'range': (1200.0, 9500.0)},
- 'pro_click': {'param': 'pitch', 'range': (1200.0, 9500.0)},
- 'toggle': {'param': 'pitch', 'range': (1600.0, 8000.0)},
+ 'click': {'param': 'pitch', 'range': (1200.0, 9500.0), 'partial': True},
+ 'pro_click': {'param': 'pitch', 'range': (1200.0, 9500.0), 'partial': True},
+ 'toggle': {'param': 'pitch', 'range': (1600.0, 8000.0), 'partial': True},
'hover_tick': {'param': 'ping_f', 'co': ('tick_f',), 'range': (3000.0, 15000.0), 'needs': ('ping', 0.1)},
'pro_hover_tick': {'param': 'ping_f', 'co': ('tick_f',), 'range': (3000.0, 15000.0), 'needs': ('ping', 0.1)},
'tap': {'param': 'body_f', 'co': ('knock_f', 'glass_f'), 'range': (70.0, 220.0)},
@@ -110,11 +122,13 @@ _NAMES = ('C', 'C#', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B')
def midi(pitch):
- """a note name ('C5', 'Eb6', 'F#4', 'Bb-1') as a MIDI number, or None when it is no note name"""
- m = re.fullmatch(r'([A-Ga-g])([#b]{0,2})(-?\d+)', str(pitch).strip())
+ """a note name ('C5', 'Eb6', 'F#4', 'Bb-1'; 's' is a sharp too, as in take file names: 'Cs5' = 'C#5') as a MIDI
+ number, or None when it is no note name"""
+ m = re.fullmatch(r'([A-Ga-g])([#sb]{0,2})(-?\d+)', str(pitch).strip())
if not m:
return None
- return 12 * (int(m.group(3)) + 1) + _PC[m.group(1).upper()] + m.group(2).count('#') - m.group(2).count('b')
+ acc = m.group(2)
+ return 12 * (int(m.group(3)) + 1) + _PC[m.group(1).upper()] + acc.count('#') + acc.count('s') - acc.count('b')
def hz(pitch):
@@ -130,7 +144,8 @@ def hz(pitch):
else:
m = re.fullmatch(r'(\d+(?:\.\d+)?)\s*(?:hz)?', str(pitch).strip(), re.I)
if not m:
- raise KnobError(f"pitch must be a note name ('C5', 'Eb6', 'F#4') or Hz (440, '440hz'), got {pitch!r}")
+ raise KnobError(f"pitch must be a note name ('C5', 'Eb6', 'F#4', 'Fs4') or Hz (440, '440hz'), got "
+ f"{pitch!r}")
f = float(m.group(1))
if not 8.0 <= f <= 20000.0:
raise KnobError(f'pitch {pitch!r} ({f:g} Hz) is outside 8 Hz - 20 kHz')
@@ -145,6 +160,17 @@ def note(f):
return f'{_NAMES[k % 12]}{k // 12 - 1}' + (f' {c:+d}c' if abs(c) >= 5 else '')
+def label(pitch):
+ """one canonical file-name label per pitch: the note name ('C#5' -> 'Cs5', 'Db5' -> 'Cs5', 523.25 -> 'C5') when
+ the pitch is within 5 cents of a note, else Hz ('445hz'). Raises KnobError for no pitch"""
+ f = hz(pitch)
+ n = 69 + 12 * np.log2(f / 440.0)
+ k = int(round(n))
+ if abs(n - k) < 0.05:
+ return f'{_NAMES[k % 12]}{k // 12 - 1}'.replace('#', 's')
+ return f'{round(f, 2):g}hz'
+
+
# ---------------------------------------------------------------------------------------------------- describe
def describe(entry):
"""what the knobs can do on one bank entry: {'dur': 'shape' | 'param' | 'trim', 'apex': bool, 'pitch': {param,
@@ -197,6 +223,8 @@ def _pitch_spec(entry):
p = entry['params']
if s.get('mode') == 'pc':
return {'param': s['param'], 'mode': 'pc', 'key': int(p[s['param']]), 'note': _NAMES[int(p[s['param']]) % 12]}
+ if s.get('partial'):
+ return _partial_spec(entry, s, sid)
need = s.get('needs')
if need and float(p.get(need[0], -1e9)) < need[1]:
raise KnobError(f'{sid}: its tonal layer is off ({need[0]} {float(p.get(need[0], 0)):g}), it has no note to '
@@ -205,26 +233,82 @@ def _pitch_spec(entry):
return {'param': s['param'], 'native_hz': round(f, 2), 'note': note(f), 'range_hz': list(s['range'])}
+def _partial_spec(entry, s, sid):
+ """a click / toggle: the heard partial is the note (module doc)"""
+ p0 = float(entry['params'][s['param']])
+ meta = entry.get('meta') or {}
+ lo, hi = s['range']
+ out = {'param': s['param'], 'mode': 'partial', 'param_hz': round(p0, 2)}
+ if 'pitch_hz' not in meta: # an entry from a bank file built before 0.3.0: measured on the first render
+ return out | {'native_hz': None, 'note': None, 'range_hz': [lo, hi], 'heard': 'measured when rendered'}
+ fh = meta['pitch_hz']
+ if not fh:
+ raise KnobError(f'{sid}: no clear tonal partial near its tink ({p0:.0f} Hz): it has no note to tune')
+ fh = float(fh)
+ return out | {'native_hz': round(fh, 2), 'note': note(fh),
+ 'range_hz': [round(lo * fh / p0, 1), round(hi * fh / p0, 1)]}
+
+
+def partial_hz(entry, x):
+ """the heard partial of a click / toggle render: the strongest clear peak within PARTIAL_SPAN_ST of its pitch
+ parameter (Hz), or None"""
+ from .bank import estimate_pitch
+ return estimate_pitch(x, float(entry['params']['pitch']), span_st=PARTIAL_SPAN_ST)
+
+
+def pitch_warning(edits):
+ """the audit warning of a take whose pitch knob missed its note ({'code': 'pitch_off', 'msg'}), else None"""
+ p = (edits or {}).get('pitch') or {}
+ if p.get('ok') is not False:
+ return None
+ got = p.get('measured_hz')
+ heard = (f"measured {note(got)} ({got:.1f} Hz, {p.get('cents_off', 0):+d} cents)" if got else
+ 'no clear partial near it in the render')
+ return {'code': 'pitch_off', 'msg': f"pitch {p.get('note')}: {heard}; the knob did not land the note "
+ f'(tolerance {PITCH_TOL_CENTS} cents)'}
+
+
# ------------------------------------------------------------------------------------------------------- apply
-def apply(entry, run, dur=None, apex=None, pitch=None):
- """(raw render, edits) of an entry with its knobs set: run(params_edit, fit_knobs) renders (bank.renderer)"""
- from . import bank
+def _number(v, name):
+ if isinstance(v, bool) or not isinstance(v, (int, float, np.integer, np.floating)) or not np.isfinite(float(v)):
+ raise KnobError(f'{name} must be a number, got {v!r}')
+ return float(v)
+
+
+def validate(entry, dur=None, apex=None, pitch=None):
+ """the knobs an entry can take, checked without rendering (KnobError says why): what apply() refuses, so a kit
+ check refuses the same (earshot.forge.kit.problems)"""
sid = entry.get('id') or _cat(entry)
- edits, pe, fk = {}, {}, {}
- if dur is not None and not 0.01 <= float(dur) <= 60:
- raise KnobError(f'dur must be 0.01-60 s, got {dur}')
+ if dur is not None:
+ dur = _number(dur, 'dur')
+ if not 0.01 <= dur <= 60:
+ raise KnobError(f'dur must be 0.01-60 s, got {dur:g}')
+ if (_cat(entry) in WHOOSH) and dur > WHOOSH_MAX_S:
+ raise KnobError(f'{sid}: the pass engine renders at most {WHOOSH_MAX_S} s (dur {dur:g})')
if apex is not None:
+ apex = _number(apex, 'apex')
if _cat(entry) not in WHOOSH:
raise KnobError(f'{sid}: apex applies to the whoosh family ({", ".join(WHOOSH)}); a riser stops on its '
'loudest sample, so aim it with dur and align its end')
- if not 0.01 <= float(apex) <= WHOOSH_MAX_S - 0.1 or (dur is not None and float(apex) >= float(dur) - 0.02):
- raise KnobError(f'apex {apex} s must lie inside the sound (0.01 s .. dur - 0.02 s)')
+ if not 0.01 <= apex <= WHOOSH_MAX_S - 0.1 or (dur is not None and apex >= dur - 0.02):
+ raise KnobError(f'apex {apex:g} s must lie inside the sound (0.01 s .. dur - 0.02 s)')
+ if pitch is not None:
+ _pitch(entry, pitch)
+
+
+def apply(entry, run, dur=None, apex=None, pitch=None):
+ """(raw render, edits) of an entry with its knobs set: run(params_edit, fit_knobs) renders (bank.renderer)"""
+ from . import bank
+ validate(entry, dur, apex, pitch)
+ edits, pe, fk = {}, {}, {}
if pitch is not None:
p_upd, f_upd, info = _pitch(entry, pitch)
pe.update(p_upd)
fk.update(f_upd)
edits['pitch'] = info
meta = entry.get('meta') or {}
+ if pitch is not None and edits['pitch'].get('mode') == 'partial':
+ pe.update(_land_partial(entry, run, pe, fk, edits['pitch']))
if apex is not None or (dur is not None and _cat(entry) in WHOOSH):
x, info = _whoosh(entry, run, pe, dur, apex, meta)
edits.update(info)
@@ -233,17 +317,60 @@ def apply(entry, run, dur=None, apex=None, pitch=None):
else:
x = run(pe, fk)
if dur is not None:
- x, how = fit_length(x, float(dur))
+ x, how = fit_length(x, float(dur), keep_s=None if apex is None else float(apex) + APEX_KEEP)
edits['dur']['fit'] = how
+ if apex is not None: # the fit to dur comes after the apex was placed: measure the file that ships
+ got = float(_peak_s(x))
+ edits['apex'].update(measured=round(got, 4), err_ms=round(1000 * (got - float(apex)), 1),
+ ok=bool(abs(got - float(apex)) <= APEX_TOL))
if pitch is not None and edits['pitch'].get('target_hz'):
where = (PITCH.get(_cat(entry)) or {}).get('measure', 'start') if entry.get('type') != 'fit' else 'start'
got = bank.estimate_pitch(_tail(x) if where == 'end' else x, edits['pitch']['target_hz']) if where else None
edits['pitch']['measured_hz'] = None if got is None else round(got, 2)
if got:
edits['pitch']['cents_off'] = int(round(1200 * np.log2(got / edits['pitch']['target_hz'])))
+ ok = bool(got) and abs(edits['pitch'].get('cents_off', 0)) <= PITCH_TOL_CENTS
+ edits['pitch']['ok'] = ok if where else None # None: a sound whose pitch is not measured (riser, impact)
return x, edits
+def _land_partial(entry, run, pe, fk, info):
+ """a click / toggle aimed at a heard note: the parameter scaled by target / heard (heard: meta pitch_hz, else
+ measured on a first render), then rendered, measured and corrected along the ratio at most MAX_FIX times; the
+ closest render's parameter is kept (its pe update). A render with no clear partial stops the search"""
+ k = info['param']
+ f = float(info['target_hz'])
+ lo, hi = PITCH[_cat(entry)]['range']
+ p0 = float(entry['params'][k])
+ v = (info.get('params') or {}).get(k)
+ if v is None: # heard partial unknown: measure the member as it is
+ fh = partial_hz(entry, run(pe, fk))
+ if fh is None:
+ raise KnobError(f"{entry.get('id')}: no clear tonal partial near its tink ({p0:.0f} Hz): it has no "
+ 'note to tune')
+ info['native_hz'] = round(fh, 2)
+ v = p0 * f / fh
+ best, n = None, 0
+ for _ in range(MAX_FIX + 1):
+ v = float(np.clip(v, lo, hi))
+ x = run({**pe, k: v}, fk)
+ n += 1
+ from .bank import estimate_pitch
+ got = estimate_pitch(x, f)
+ if got is None:
+ best = best or (v, None)
+ break
+ c = 1200 * np.log2(got / f)
+ if best is None or best[1] is None or abs(c) < abs(best[1]):
+ best = (v, c)
+ if abs(c) <= PITCH_TOL_CENTS / 2:
+ break
+ v *= f / got
+ info['params'] = {k: round(best[0], 3)}
+ info['renders'] = n
+ return {k: best[0]}
+
+
def _tail(x):
"""the second half of a render (a glide's landing), as a sound of its own"""
return x[len(x) // 2:]
@@ -260,6 +387,11 @@ def _pitch(entry, pitch):
'native_key': s['key'], 'mode': 'pitch class only (the register stays)'}
f = hz(pitch)
lo, hi = s['range_hz']
+ if s.get('mode') == 'partial' and s['native_hz'] is None: # heard partial unknown until a render: range check
+ if not lo <= f <= hi: # on the parameter, landed in apply()
+ raise KnobError(f'{sid}: {note(f)} ({f:.1f} Hz) is outside its {s["param"]} range {lo:g}-{hi:g} Hz')
+ return {}, {}, {'target_hz': round(f, 3), 'note': note(f), 'native_hz': None, 'param': s['param'],
+ 'mode': 'partial'}
if not lo <= f <= hi:
raise KnobError(f'{sid}: {note(f)} ({f:.1f} Hz) is outside its {s["param"]} range {lo:g}-{hi:g} Hz '
f'({note(lo)} - {note(hi)}); its own note is {s["note"]} ({s["native_hz"]:g} Hz)')
@@ -273,6 +405,11 @@ def _pitch(entry, pitch):
return {}, {k: v}, info
p = entry['params']
ratio = f / s['native_hz']
+ if s.get('mode') == 'partial': # the parameter moves by the heard ratio; apply() measures and corrects
+ info['mode'] = 'partial'
+ upd = {s['param']: float(p[s['param']]) * ratio}
+ info['params'] = {k: round(v, 3) for k, v in upd.items()}
+ return upd, {}, info
upd = {s['param']: f}
for k in (PITCH[_cat(entry)].get('co') or ()):
if k in p and isinstance(p[k], (int, float)) and not isinstance(p[k], bool):
@@ -354,19 +491,20 @@ def _whoosh(entry, run, pe, dur, apex, meta):
x = run({**pe, 'rise': rise, 'hold': h0 * q, 'fall': f0 * q})
n += 1
pk, L = _peak_s(x), _len_s(x)
- if best is None or abs(pk - apex) < abs(best[1] - apex):
- best = (x, pk, rise, q)
+ err = abs(pk - apex) + (0.0 if post_t is None else abs((L - pk) - post_t))
+ if best is None or err < best[4]:
+ best = (x, pk, rise, q, err)
ok_d = post_t is None or abs(L - float(dur)) <= max(DUR_ABS, DUR_REL * float(dur))
if (abs(pk - apex) <= APEX_TOL and ok_d) or n > MAX_FIX:
break
rise = float(np.clip(rise * apex / max(pk, 1e-3), 0.25 * r1, 4.0 * r1))
if post_t is not None:
q = float(np.clip(q * post_t / max(L - pk, 1e-3), *SCALE))
- x, pk, rise, q = best
+ x, pk, rise, q, _ = best
x, head = place_apex(x, pk, apex)
- got = _peak_s(x)
+ got = float(_peak_s(x))
info['apex'] = {'target': apex, 'measured': round(got, 4), 'err_ms': round(1000 * (got - apex), 1),
- 'search_err_ms': round(1000 * (pk - apex), 1), 'rise': round(rise, 5), 'renders': n,
+ 'search_err_ms': round(float(1000 * (pk - apex)), 1), 'rise': round(rise, 5), 'renders': n,
'fit': head, 'ok': bool(abs(got - apex) <= APEX_TOL)}
if dur is not None:
info['dur'] = {'target': float(dur), 'method': 'shape', 'post_scale': round(q, 4), 'renders': n}
@@ -380,8 +518,11 @@ def place_apex(x, pk, apex):
"""move the loudest moment from pk to apex exactly: trim the quiet approach (a 3 ms fade-in after the cut) when
the peak is late, pad silence before the start when it is early. The parameter search gets close (a fluttering
pass's 5 ms peak moves non-monotonically with rise: +-50 ms for a 10 % change on the big families); this lands it.
- Returns (x, 'exact' | 'head trim N ms' | 'head pad N ms' | 'head kept: ...')"""
- n = int(round((pk - apex) * SR))
+ Returns (x, 'exact' | 'head trim N ms' | 'head pad N ms' | 'head kept: ...'). The shift is a whole number of the
+ peak measure's 1 ms hops (bank.times): a shift off that grid re-reads a fluttering pass's near-equal maxima (0.2 dB
+ apart, 15 ms apart on whoosh_big/swell) and can move the measured peak by more than the shift"""
+ hop = SR // 1000
+ n = int(round((pk - apex) * SR / hop)) * hop
if n == 0:
return x, 'exact'
if n < 0:
@@ -397,8 +538,13 @@ def place_apex(x, pk, apex):
return y, f'head trim {1000 * n / SR:.1f} ms'
-def fit_length(x, dur):
- """x cut or padded to exactly dur seconds: (x, 'exact' | 'trim N ms' | 'pad N ms')"""
+FADE_MIN_S = 0.002 # fit_length's shortest fade-out (when keep_s leaves less room than the usual quarter)
+
+
+def fit_length(x, dur, keep_s=None):
+ """x cut or padded to exactly dur seconds: (x, 'exact' | 'trim N ms' | 'pad N ms'). A cut fades out over a quarter
+ of the length (10-150 ms); keep_s (s) keeps the fade from starting before that point (an apex just before the end:
+ the fade then shortens, to at least FADE_MIN_S)"""
n = int(round(dur * SR))
if len(x) == n:
return x, 'exact'
@@ -408,6 +554,8 @@ def fit_length(x, dur):
cut = len(x) - n
y = np.array(x[:n], np.float64)
k = min(n, max(int(0.01 * SR), min(int(0.15 * SR), int(0.25 * n))))
+ if keep_s is not None:
+ k = min(n, max(int(FADE_MIN_S * SR), min(k, n - int(round(float(keep_s) * SR)))))
w = 0.5 + 0.5 * np.cos(np.linspace(0, np.pi, k))
y[n - k:] *= w if y.ndim == 1 else w[:, None]
- return y, f'trim {1000 * cut / SR:.0f} ms'
+ return y, f'trim {1000 * cut / SR:.0f} ms' + (f' (fade {1000 * k / SR:.0f} ms)' if keep_s is not None else '')
diff --git a/earshot/forge/sfx.py b/earshot/forge/sfx.py
index bd584a0..0959fe3 100644
--- a/earshot/forge/sfx.py
+++ b/earshot/forge/sfx.py
@@ -9,6 +9,9 @@
sfx.rising_glide(y), sfx.layers(y)
`list` / `render` are the bank (earshot.forge.bank; knobs: earshot.forge.knobs). `check` measures, it never listens:
+ silent nothing to hear: a sample peak under SILENT_DBFS (-60 dBFS), or less than SILENT_MS (5 ms) within
+ 40 dB of its peak (1 ms RMS frames; the shortest bank sound, pro_hover_tick/air, holds 9 ms): digital
+ silence, or a take faded to nothing
clicks, edge polish.clicks: isolated discontinuities inside the sound; a first / last sample off zero
clipping flat tops at the peak, samples over full scale
dc an offset (|mean| > -40 dB re peak)
@@ -45,6 +48,8 @@ SR = 48000
GLIDE_ST = 4.0
GLIDE_MIN_S = 0.05
PRE_SWELL_MS = 100.0
+SILENT_DBFS = -60.0
+SILENT_MS = 5.0
HIT_ROLES = ('hit', 'land')
GATED = ('glitch', 'pro_glitch', 'riser', 'pro_riser', 'pro_zip', 'pro_impact')
DESIGNED = ('glitch', 'pro_glitch')
@@ -142,6 +147,20 @@ def layers(x, peak_db=-6.0, dip_db=10.0, window_s=0.5, win=0.025, hop=0.005):
'pre_swell_ms': round((i6 - i30) * 1000.0 * h / SR, 1)}
+def live_ms(x, db=-40.0):
+ """how long a sound stays within db of its loudest moment: 1 ms RMS frames every 0.25 ms, counted (ms)"""
+ m = _mono(x)
+ w, h = SR // 1000, SR // 4000
+ if len(m) < w:
+ m = np.pad(m, (0, w - len(m)))
+ c = np.concatenate([[0.0], np.cumsum(m * m)])
+ st = np.arange(0, len(m) - w + 1, h)
+ e = (c[st + w] - c[st]) / w
+ if not len(e) or e.max() <= 0:
+ return 0.0
+ return float((e >= e.max() * 10 ** (db / 10)).sum() * 1000.0 * h / SR)
+
+
def _ends_on_peak(x):
m = np.abs(_mono(x))
return len(m) > 0 and int(np.argmax(m)) >= 0.97 * len(m)
@@ -161,6 +180,13 @@ def check(x, sr=SR, category=None, role=None, sound=None):
(notes if soft else warn).append({'code': code, 'msg': msg})
designed = category in DESIGNED
gated = category in GATED or _ends_on_peak(y)
+ pk = float(np.abs(y).max()) if np.size(y) else 0.0
+ peak_dbfs = 20 * np.log10(pk) if pk > 0 else -np.inf
+ live = live_ms(y)
+ if peak_dbfs < SILENT_DBFS or live < SILENT_MS:
+ add('silent', 'digital silence: nothing to hear' if pk == 0 else
+ f'nearly silent: peak {peak_dbfs:.0f} dBFS, {live:.1f} ms within 40 dB of its peak (a take faded to '
+ 'nothing, or a level far too low)')
if m['clicks']:
add('clicks', f"{m['clicks']} click{'s' if m['clicks'] != 1 else ''} at "
+ ', '.join(f'{t:.3f} s' for t in m['click_times'][:4]), soft=designed)
@@ -194,13 +220,14 @@ def check(x, sr=SR, category=None, role=None, sound=None):
soft=not hit)
keep = ('clicks', 'edge_db', 'clip_runs', 'overs', 'dc_db', 'ring_z', 'trunc_db', 'silence_ms', 'bump_db',
'attack_ms', 't40_ms', 'crest_db', 'res_db', 'res_hz')
+ extra = {'peak_dbfs': round(peak_dbfs, 2) if np.isfinite(peak_dbfs) else None, 'live_ms': round(live, 2)}
name = sound or (os.path.basename(x) if isinstance(x, str) else 'sound')
if warn:
summary = f"{name}: {len(warn)} warning{'s' if len(warn) != 1 else ''}: " + '; '.join(w['msg'] for w in warn)
else:
summary = f'{name}: clean' + (f" ({'; '.join(n['msg'] for n in notes)})" if notes else '')
return {'ok': not warn, 'warnings': warn, 'notes': notes, 'summary': summary,
- 'measures': {k: m.get(k) for k in keep}, 'glide': g, 'layers': lay,
+ 'measures': {**{k: m.get(k) for k in keep}, **extra}, 'glide': g, 'layers': lay,
'context': {k: v for k, v in (('category', category), ('role', role), ('sound', sound)) if v}}
@@ -276,9 +303,10 @@ def add_cli(sub):
pr.add_argument('--dur', type=float, help='length in seconds (exact)')
pr.add_argument('--apex', type=float, help='seconds from the start to the loudest moment (whoosh family)')
pr.add_argument('--pitch', help="note name ('E5', 'Eb6') or Hz, through the recipe's own pitch parameter")
- pr.add_argument('--peak', type=float, default=-1.0, help='sample peak in dBFS (default -1)')
+ pr.add_argument('--peak', type=float, default=-1.0, help='sample peak in dBFS, 0 or less (default -1)')
pr.add_argument('--weight', type=float, help='level relative to --peak, 6 dB per doubling (0.5 = 6 dB down)')
- pr.add_argument('--sr', type=int, default=SR, help='sample rate of the WAV (default 48000)')
+ pr.add_argument('--sr', type=int, default=SR, choices=(44100, 48000, 88200, 96000),
+ help='sample rate of the WAV (default 48000)')
pc = common(s.add_parser('check', help='model-free audit: clicks, truncation, clipping, DC, ring, tail, rising '
'pitch glide, stacked hits'))
pc.add_argument('files', nargs='+')
diff --git a/skills/earshot/SKILL.md b/skills/earshot/SKILL.md
index bd81d24..837ac72 100644
--- a/skills/earshot/SKILL.md
+++ b/skills/earshot/SKILL.md
@@ -153,9 +153,11 @@ bank instead of writing synth voices. No models load; a whole kit renders in abo
3. Render: `earshot kit render audio/kit.json --out audio/kit`. The takes and `kit.lock.json` (measured onset, peak,
end, loudness per take) are what the mixer places on cue frames: onset on the frame for hits and touches, the
peak on a whoosh's apex, the end on a riser's hit.
-4. Check: `earshot kit check audio/kit.json --out audio/kit`. Every warning names a take and a reason (clicks, a cut
- tail, comb ring, a pitch that climbs more than 4 semitones, a hit with two attacks or a build before it); swap the
- sound or the knob rather than keeping a warned take. Read the notes too (a sounded riser, a composite sting).
+4. Check: `earshot kit check audio/kit.json --out audio/kit`. It refuses what a render cannot use (a knob or pitch
+ the sound cannot take, a level over 0 dBFS, two takes that would share a file). Every warning names a take and a
+ reason (clicks, a cut tail, comb ring, silence, a pitch that climbs more than 4 semitones, a hit with two attacks
+ or a build before it, `pitch_off`: a note the knob did not land); swap the sound or the knob rather than keeping a
+ warned take. Read the notes too (a sounded riser, a composite sting).
5. Listen through the finished film with Loop 2 (`timeline --cues`, `sheet`) and check that each cue landed.
Say plainly what the bank is: forge sounds made in code, and 15 sounds fitted as code from CC0 recordings
(`fit/<role>/<name>`, each with its source; the presets use them for clicks, ticks, keys, touches and the snap), all
diff --git a/tests/test_bank.py b/tests/test_bank.py
index c312536..8ff234b 100644
--- a/tests/test_bank.py
+++ b/tests/test_bank.py
@@ -124,6 +124,45 @@ def test_levels_weight_and_sr():
assert abs(len(y44) - round(len(y) * 44100 / SR)) <= 2 and m44['sr'] == 44100
+def test_levels_over_0_dbfs_and_odd_sample_rates_are_refused(tmp_path, capsys):
+ """review: `sfx render --peak 3` wrote a clipped WAV (exit 0) and any sr was resampled to, while --weight, the MCP
+ tool and kits refused or restricted them"""
+ for bad in (3.0, 0.5, float('nan'), True, '-1'):
+ with pytest.raises(bank.BankError, match='over 0 dBFS|must be a number'):
+ bank.render('tap/finger', peak_db=bad, checks=False)
+ y, m = bank.render('tap/finger', peak_db=0.0, checks=False) # 0 dBFS itself is fine
+ assert abs(m['peak_db']) < 0.01
+ for sr in (1000, 22050, 48000.5, True, '48000'):
+ with pytest.raises(bank.BankError, match='sr must be one of'):
+ bank.render('tap/finger', sr=sr, checks=False)
+ from earshot import cli
+ f = str(tmp_path / 'clip.wav')
+ assert cli.main(['sfx', 'render', 'tap/finger', '-o', f, '--peak', '3']) == 1 and not os.path.exists(f)
+ assert 'over 0 dBFS' in capsys.readouterr().err
+ with pytest.raises(SystemExit): # argparse: not one of the choices
+ cli.main(['sfx', 'render', 'tap/finger', '-o', f, '--sr', '1000'])
+
+
+def test_earshot_bank_missing_file_is_a_readable_error(monkeypatch, tmp_path, capsys):
+ """review: EARSHOT_BANK naming a missing file broke every bank command with a raw FileNotFoundError; the docstring
+ gave ';' as the separator, which is os.pathsep only on Windows"""
+ missing = str(tmp_path / 'nope.json')
+ monkeypatch.setenv('EARSHOT_BANK', missing)
+ with pytest.raises(bank.BankError, match='EARSHOT_BANK file .*nope.json not found'):
+ bank.ids()
+ from earshot import cli
+ assert cli.main(['sfx', 'list']) == 1
+ err = capsys.readouterr().err
+ assert 'BankError' in err and 'not found' in err and 'Traceback' not in err
+ junk = tmp_path / 'junk.json'
+ junk.write_text('{not json', encoding='utf-8')
+ monkeypatch.setenv('EARSHOT_BANK', str(junk))
+ with pytest.raises(bank.BankError, match='not readable as a bank file'):
+ bank.ids()
+ monkeypatch.delenv('EARSHOT_BANK')
+ assert 'os.pathsep' in bank.__doc__ and len(bank.ids()) > 180
+
+
def _final(tmp_path, sid, scale=1.0):
"""a forge final folder holding one bank entry: report.json with its render block + the WAV it renders"""
e = bank.get(sid)
@@ -165,6 +204,20 @@ def test_note_parsing():
knobs.hz(bad)
+def test_s_sharps_and_canonical_labels():
+ """review: take files spell sharps 's' (bell_Cs5.wav) and cinetic's kit.py accepts 'Cs5', but knobs.midi refused
+ it, so `kit render` died on a kit that `kit check` passed"""
+ assert knobs.midi('Cs5') == knobs.midi('C#5') == knobs.midi('Db5') == 73 and knobs.midi('fs4') == 66
+ assert abs(knobs.hz('Cs5') - knobs.hz('C#5')) < 1e-9
+ y, m = bank.render('pluck/kalimba', pitch='Cs5', checks=False)
+ assert m['edits']['pitch']['note'] == 'C#5' and m['edits']['pitch']['ok']
+ assert {knobs.label(p) for p in ('C#5', 'Db5', 'Cs5', 554.365)} == {'Cs5'}
+ assert knobs.label('440') == knobs.label('440hz') == knobs.label('A4') == 'A4'
+ assert knobs.label(445) == '445hz' and knobs.label('Eb6') == 'Eb6'
+ with pytest.raises(knobs.KnobError):
+ knobs.label('H5')
+
+
def test_dur_lands_exactly():
y, m = bank.render('pro_riser/air_gate', dur=1.0) # the riser's own length key: exact, ends on its peak
assert len(y) == SR and m['edits']['dur']['method'] == 'param' and m['peak_s'] > 0.97
@@ -178,6 +231,41 @@ def test_dur_lands_exactly():
assert len(y) == int(0.06 * SR) and m['edits']['dur']['method'] == 'param'
+def test_fit_length_fade_starts_after_keep_s():
+ t = np.arange(int(0.6 * SR)) / SR
+ x = np.minimum(t / 0.5, 1.0) # a ramp that peaks at 0.5 s, then holds
+ y, how = knobs.fit_length(x, 0.52)
+ assert y[int(0.5 * SR)] < 0.9 # the default fade (a quarter, 130 ms) covers the peak
+ y, how = knobs.fit_length(x, 0.52, keep_s=0.505)
+ assert np.array_equal(y[:int(0.505 * SR)], x[:int(0.505 * SR)]) and 'fade 15 ms' in how
+ assert len(y) == int(0.52 * SR) and abs(y[-1]) < 1e-3
+
+
[email protected]('sid,apex,dur', [('whoosh_big/swell', 0.5, 0.6), ('whoosh_fast/heavy', 0.5, 0.6),
+ ('swipe/velvet', 0.4, 0.43)])
+def test_apex_with_a_short_tail_lands_and_edits_say_what_ships(sid, apex, dur):
+ """review: the fade that fits a whoosh to dur covered an apex 0.03-0.1 s before the end, so the delivered peak
+ came 34-189 ms early while edits['apex'] (measured before the fit) said ok"""
+ y, m = bank.render(sid, apex=apex, dur=dur)
+ a = m['edits']['apex']
+ assert abs(m['peak_s'] - apex) <= knobs.APEX_TOL, a
+ assert abs(a['measured'] - m['peak_s']) <= 0.001 and a['ok'] is True
+ assert len(y) == int(round(dur * SR)) and 'fade' in m['edits']['dur']['fit']
+
+
+def test_apex_ok_is_false_when_the_delivered_file_misses(monkeypatch):
+ """edits['apex'] describes the delivered file: with the old fit (a fade over the apex) the miss is reported"""
+ real = knobs.fit_length
+
+ def old_fit(x, dur, keep_s=None):
+ return real(x, dur)
+ monkeypatch.setattr(knobs, 'fit_length', old_fit)
+ y, m = bank.render('whoosh_big/swell', apex=0.5, dur=0.6)
+ a = m['edits']['apex']
+ assert abs(a['measured'] - m['peak_s']) <= 0.001
+ assert abs(m['peak_s'] - 0.5) > knobs.APEX_TOL and a['ok'] is False
+
+
@pytest.mark.parametrize('sid,apex,dur', [('whoosh_fast/tight', 0.25, None), ('whoosh_fast/tight', 0.3, 0.7),
('swipe/velvet', 0.12, 0.5)])
def test_apex_lands_within_5_ms(sid, apex, dur):
@@ -191,7 +279,8 @@ def test_apex_lands_within_5_ms(sid, apex, dur):
def test_pitch_goes_through_the_recipe():
y, m = bank.render('pluck/kalimba', pitch='E5')
p = m['edits']['pitch']
- assert p['param'] == 'f0' and abs(p['cents_off']) <= 30 and p['semitones'] == 4.0
+ assert p['param'] == 'f0' and abs(p['cents_off']) <= 30 and p['semitones'] == 4.0 and p['ok'] is True
+ assert 'pitch_off' not in {w['code'] for w in m['checks']['warnings']}
y, m = bank.render('pro_sub_drop/quick', pitch='G1')
p = m['edits']['pitch']
e = bank.get('pro_sub_drop/quick')['params']
@@ -200,6 +289,37 @@ def test_pitch_goes_through_the_recipe():
assert p['measured_hz'] and abs(p['cents_off']) <= 50
+def test_click_pitch_lands_on_the_heard_partial():
+ """review: a click's `pitch` is its tink centre, not the partial heard (click/soft 2454 Hz, heard 2903 Hz), so
+ --pitch C7 measured 362 cents off with no warning while describe advertised a native note. The note is now the
+ measured partial, a target is landed by measurement, and edits.pitch.ok says whether it landed"""
+ d = knobs.describe(bank.get('click/soft'))['pitch']
+ assert d['mode'] == 'partial' and abs(d['native_hz'] - 2903.4) < 1 and d['note'] == knobs.note(d['native_hz'])
+ assert abs(d['param_hz'] - 2454.3) < 1 and d['range_hz'][0] > 1200 * 2903 / 2455 - 1
+ for sid in ('click/soft', 'pro_click/glass', 'pro_click/mouse'):
+ y, m = bank.render(sid, pitch='C7')
+ p = m['edits']['pitch']
+ assert p['ok'] is True and abs(p['cents_off']) <= knobs.PITCH_TOL_CENTS, (sid, p)
+ assert 'pitch_off' not in {w['code'] for w in m['checks']['warnings']}
+ with pytest.raises(knobs.KnobError, match='no clear tonal partial'):
+ bank.render('click/thock', pitch='C7')
+ assert knobs.describe(bank.get('click/thock'))['pitch'] is None
+ with pytest.raises(knobs.KnobError, match='outside its pitch range'):
+ bank.render('toggle/latch', pitch='C7') # heard 3370 Hz: its range starts at ~2266 Hz
+
+
+def test_a_missed_pitch_is_a_pitch_off_warning(monkeypatch):
+ """edits.pitch.ok False puts 'pitch_off' in the render's checks (and a kit take's), so a take that missed its note
+ is re-rolled or reported, never silently kept"""
+ assert knobs.pitch_warning({'pitch': {'ok': True}}) is None and knobs.pitch_warning({}) is None
+ w = knobs.pitch_warning({'pitch': {'ok': False, 'note': 'C7', 'measured_hz': 2579.7, 'cents_off': 362}})
+ assert w['code'] == 'pitch_off' and '+362 cents' in w['msg']
+ monkeypatch.setattr(knobs, 'PITCH_TOL_CENTS', -1) # nothing lands now
+ y, m = bank.render('pluck/kalimba', pitch='E5')
+ assert m['edits']['pitch']['ok'] is False and not m['checks']['ok']
+ assert 'pitch_off' in {w['code'] for w in m['checks']['warnings']} and 'pitch E5' in m['checks']['summary']
+
+
def test_pitch_and_apex_refusals_say_why():
with pytest.raises(knobs.KnobError, match='noise pass-by'):
bank.render('whoosh_fast/crisp', pitch='C5')
diff --git a/tests/test_sfx_kit.py b/tests/test_sfx_kit.py
index fed889e..83a8a7b 100644
--- a/tests/test_sfx_kit.py
+++ b/tests/test_sfx_kit.py
@@ -79,6 +79,22 @@ def test_artifacts_are_flagged():
assert 'truncated' in _codes(sfx.check(cut.astype(np.float32), category='riser'), 'notes') # the design
+def test_silence_is_flagged(wav, capsys):
+ """review: sfx.check(np.zeros(4800)) and a kit take faded to nothing by a tiny max_s were called 'clean'"""
+ z = sfx.check(np.zeros(4800, np.float32))
+ assert not z['ok'] and 'silent' in _codes(z) and 'digital silence' in z['summary']
+ t = np.arange(int(0.2 * SR)) / SR
+ tone = 0.5 * np.sin(2 * np.pi * 440 * t) * np.exp(-t / 0.05)
+ assert 'silent' in _codes(sfx.check((tone * 1e-4).astype(np.float32))) # peak -86 dBFS
+ blip = np.zeros(int(0.2 * SR))
+ blip[1000:1060] = np.hanning(60) * 0.5 # ~1 ms of sound
+ assert 'silent' in _codes(sfx.check(blip.astype(np.float32)))
+ y, _ = bank.render('pro_hover_tick/air', checks=False) # the shortest bank sound
+ assert 'silent' not in _codes(sfx.check(y)) and sfx.live_ms(y) > 1.5 * sfx.SILENT_MS
+ assert cli.main(['sfx', 'check', wav(np.zeros(4800))]) == 1
+ assert 'digital silence' in capsys.readouterr().out
+
+
# --------------------------------------------------------------------------------------------------------- kits
def test_presets_are_valid_restrained_and_explained():
assert kit.presets() == ['calm', 'crisp', 'minimal']
@@ -98,7 +114,33 @@ def test_presets_are_valid_restrained_and_explained():
hits = [s['sound'] for r, s in k['roles'].items() if s and r == 'hit']
assert len(hits) == 1
files = [t['file'] for t in kit.plan(k)]
- assert len(files) == len(set(files))
+ assert len(files) == len({f.lower() for f in files})
+
+
+def _midi(p):
+ from earshot.forge import knobs
+ return knobs.midi(p)
+
+
[email protected]('name', ['calm', 'crisp', 'minimal'])
+def test_presets_have_the_rungs_a_progress_motif_needs(name):
+ """review (cinetic 5.5b): with 5 bell takes a climbing progress motif ran out of rungs; the bell now spans two
+ octaves of one pentatonic (10 notes), and a tonal text role offers the 5 pentatonic degrees of one octave so a
+ chain can step through the chord's tones. An untuned text role (crisp, minimal: a soft tap, untuned on purpose)
+ rotates its takes instead"""
+ k = kit.preset(name)
+ bell = [_midi(p) for p in k['roles']['bell']['pitches']]
+ assert len(bell) == 10 and bell == sorted(bell) and len(set(bell)) == 10
+ pcs = {m % 12 for m in bell}
+ assert len(pcs) == 5 and max(bell) - min(bell) >= 21 # two octaves of a pentatonic
+ steps = sorted({(b - a) for a, b in zip(sorted(pcs), sorted(pcs)[1:] + [min(pcs) + 12])})
+ assert steps == [2, 3] # whole steps and minor thirds only
+ text = k['roles']['text']
+ if text.get('pitches'):
+ tm = [_midi(p) for p in text['pitches']]
+ assert len({m % 12 for m in tm}) >= 5 and {m % 12 for m in tm} <= pcs and max(tm) - min(tm) < 12
+ else:
+ assert text['takes'] >= 3 and 'untuned' in text['note']
LISTENING_WORDS = re.compile(r'listener|blind test|picked out|taken for recordings|heard as|to the ear', re.I)
@@ -180,6 +222,75 @@ def test_kit_check_and_problems(tmp_path):
kit.load(bad)
[email protected]('spec,match', [
+ ({'sound': 'tap/finger', 'level_db': None}, 'level_db must be a number'),
+ ({'sound': 'tap/finger', 'level_db': True}, 'level_db must be a number'),
+ ({'sound': 'tap/finger', 'max_s': -1}, 'max_s must be a number of seconds, 0.01 or more'),
+ ({'sound': 'tap/finger', 'max_s': 0.001}, 'max_s must be a number of seconds, 0.01 or more'),
+ ({'sound': 'tap/finger', 'edits': {'peak_db': 6}}, 'over 0 dBFS'),
+ ({'sound': 'tap/finger', 'edits': {'weight': 2.0}}, 'over 0 dBFS|lower peak_db'),
+ ({'sound': 'tap/finger', 'edits': {'dur': 'long'}}, 'edits.dur must be a number'),
+ ({'sound': 'tap/finger', 'edits': {'dur': 0.001}}, 'dur must be 0.01-60'),
+ ({'sound': 'pluck/kalimba', 'pitches': ['C5', 'H5']}, "pitch 'H5'"),
+ ({'sound': 'pluck/kalimba', 'pitches': ['C1']}, 'outside its f0 range'),
+ ({'sound': 'whoosh_fast/crisp', 'edits': {'pitch': 'C5'}}, 'noise pass-by'),
+ ({'sound': 'click/soft', 'edits': {'apex': 0.05}}, 'whoosh family'),
+ ({'sound': 'whoosh_fast/tight', 'edits': {'dur': 0.3, 'apex': 0.29}}, 'must lie inside the sound'),
+ ({'sound': 'pluck/kalimba', 'pitches': ['440', '440hz']}, 'are one pitch'),
+ ({'sound': 'pluck/kalimba', 'pitches': ['C#5', 'Db5']}, 'are one pitch'),
+ ({'sound': 'pluck/kalimba', 'pitches': ['C5', 'c5']}, 'are one pitch'),
+])
+def test_kit_check_refuses_what_kit_render_cannot_use(tmp_path, spec, match):
+ """review: problems() let through values that made `kit render` crash (level_db null, max_s -1, a bad pitch after
+ a first take was written), render silence (max_s 0.001), clip (peak_db 6) or overwrite one take with another
+ (two spellings of one pitch): check and render now refuse the same things"""
+ k = {'kit': 1, 'name': 'bad', 'sr': 48000, 'roles': {'bell': spec}}
+ probs = kit.problems(k)
+ assert probs and re.search(match, '; '.join(probs)), probs
+ r = kit.check(k)
+ assert not r['ok'] and r['problems'] and not r['roles']
+ with pytest.raises(kit.KitError):
+ kit.render(k, str(tmp_path / 'takes'))
+ assert not (tmp_path / 'takes').exists() or not os.listdir(tmp_path / 'takes')
+
+
+def test_kit_sr_and_role_name_collisions_are_problems():
+ base = {'kit': 1, 'roles': {'tick': {'sound': 'tap/finger'}}}
+ for sr in ('48000x', True, 22050, None):
+ assert any('sr' in p for p in kit.problems(dict(base, sr=sr))), sr
+ two = {'kit': 1, 'roles': {'bell': {'sound': 'pluck/kalimba', 'pitches': ['C5'], 'takes': 2},
+ 'bell_c5': {'sound': 'tap/finger', 'takes': 2}}}
+ assert any('case-insensitive' in p for p in kit.problems(two))
+ with pytest.raises(kit.KitError, match='case-insensitive'):
+ kit.plan(two)
+
+
+def test_kit_take_labels_are_canonical(tmp_path):
+ """one label per pitch (knobs.label): 'Db5' and 'Cs5' render to bell_Cs5.wav, Hz that equal a note take its name;
+ kit render accepts every pitch kit check accepts (review: 'Cs5' passed the check and failed the render)"""
+ k = {'kit': 1, 'name': 'labels', 'roles': {'bell': {'sound': 'pluck/kalimba', 'pitches': ['Db5', '587.33', 'Fs5']},
+ 'text': {'sound': 'pluck/kalimba_soft', 'pitches': ['Cs5']}}}
+ assert kit.problems(k) == []
+ assert [t['file'] for t in kit.plan(k)] == ['bell_Cs5.wav', 'bell_D5.wav', 'bell_Fs5.wav', 'text_Cs5.wav']
+ lock = kit.render(k, str(tmp_path / 'takes'))
+ assert lock['stats']['rendered'] == 4 and 'checks clean' in lock['summary']
+ assert [t['pitch'] for t in lock['roles']['bell']['takes']] == ['Db5', '587.33', 'Fs5'] # as written
+
+
+def test_kit_pitch_off_is_reported_by_render_and_check(tmp_path, monkeypatch):
+ from earshot.forge import knobs
+ k = {'kit': 1, 'name': 'off', 'roles': {'bell': {'sound': 'pluck/kalimba', 'pitches': ['E5']}}}
+ monkeypatch.setattr(knobs, 'PITCH_TOL_CENTS', -1) # nothing lands: every take misses
+ lock = kit.render(k, str(tmp_path / 'takes'))
+ tk = lock['roles']['bell']['takes'][0]
+ assert 'pitch_off' in tk['checks'] and 'bell:pitch_off' in lock['summary']
+ r = kit.check(k, str(tmp_path / 'takes')) # from the rendered file + the lock
+ assert not r['ok'] and r['roles']['bell'][0]['source'] == 'rendered file'
+ assert 'pitch_off' in {w['code'] for w in r['roles']['bell'][0]['warnings']}
+ monkeypatch.setattr(knobs, 'PITCH_TOL_CENTS', 50)
+ assert kit.check(k)['ok']
+
+
def test_kit_audition(tmp_path):
r = kit.audition(_tiny(), str(tmp_path / 'aud.wav'), takes=str(tmp_path / 'takes'))
y, fs = sf.read(str(tmp_path / 'aud.wav'))