aqua-feel: keep the held envelope for attack only; activeEnd, crest and the plot use the raw one
The 30 ms release hold inflated activeEnd by up to ~170 ms on percussive items and shifted crest, rms and noise-to-tone (808-hat activeMs 61 -> 187). Found in the second review pass; values return to the first run's. Doc cell for PRC attackMs corrected. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1bf99e5c3f
commit
d4dce3ec0c
3 changed files with 9 additions and 9 deletions
|
|
@ -19,7 +19,7 @@ loudness; sfxr golf: true peak, loudness, low motion; sfxr explosion: low motion
|
|||
noiseToToneDb -17.18 -> -17.18 +0.00
|
||||
noiseToToneADb -19.14 -> -19.14 +0.00
|
||||
onsetMs 0.13 -> 0.13 +0.00
|
||||
attackMs 0.33 -> 0.33 +0.00
|
||||
attackMs 0.33 -> 4.50 (the metric changed to a 150 ms window with a held envelope during review; the patch did not)
|
||||
lowMotion false -> false
|
||||
|
||||
The shipped file's `patch gain=1.4` is the constant the parity probe in `Dx7ReferenceParityTests` writes; the probe asserts
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ nobody has diffed the two.
|
|||
| metric | meaning | limits |
|
||||
|---|---|---|
|
||||
| `onsetMs` | first sample at or above max(-40 dB re peak, -70 dBFS), from note-on | Offline render has no device latency; this is the patch's own lead-in only |
|
||||
| `attackMs`, `attackSlopeDbPerMs`, `attackWindowLimited` | 10% to 90% of the envelope maximum inside the first 150 ms after onset, on a 0.17 ms peak-hold envelope (30 ms release, so a low tone's zero crossings are not read as dips) | A faster attack reads as one hop. A swell longer than 150 ms reports a lower bound and sets `attackWindowLimited`. The envelope is a peak follower, so a tone below ~30 Hz would still ripple |
|
||||
| `attackMs`, `attackSlopeDbPerMs`, `attackWindowLimited` | 10% to 90% of the envelope maximum inside the first 150 ms after onset, on a 0.17 ms peak-hold envelope (30 ms release, so a low tone's zero crossings are not read as dips) | A faster attack reads as one hop. Ripple in the first peaks pulls the 90% point late (muted-pluck declares 1 ms and reads about 7); sustained noise beds read an arbitrary 60-130 ms. A swell longer than 150 ms reports a lower bound and sets `attackWindowLimited`. The envelope is a peak follower, so a tone below ~30 Hz would still ripple |
|
||||
| `samplePeak`, `truePeakDb`, `overSamples`, `flatTopRuns` | peak, 4x-oversampled true peak, samples beyond 1.0, runs of 3+ samples at 0.999 | WAVs are float32 so overs survive to disk |
|
||||
| `loudnessLufs` | BS.1770-4 integrated, mono, K-weighted (48 kHz coefficients; renders are fixed at 48 kHz), gated | A mono sound with no reference level; compare items, do not read it as a delivered loudness. A buffer under 400 ms is zero-padded to one block and reads low (0.1 s of full 1 kHz sine: -9.0, true -3.0); every shipped item is 1.5 s or longer |
|
||||
| `crestDb`, `rmsDb` | over the active span (onset to last frame within 50 dB of peak) | |
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@ export function integratedLoudness(x) {
|
|||
|
||||
// ---- time structure ----------------------------------------------------------------------------------------------
|
||||
const HOP = 8; // envelope hop in samples (0.167 ms)
|
||||
// Peak-hold envelope: max |x| per hop, held with a 30 ms exponential release so the zero crossings of a low tone do not
|
||||
// read as dips (a plain per-hop max does: a 261 Hz sine "falls" 100% twice per cycle). The attack stays instantaneous.
|
||||
// Envelope: max |x| per hop. With held=true it also decays with a 30 ms release so the zero crossings of a low tone do not
|
||||
// read as dips; only the attack uses that (the hold smears decays, so activeEnd, crest and the gallery plot use the raw one).
|
||||
const RELEASE_S = 0.03;
|
||||
export function envelope(x) {
|
||||
export function envelope(x, held = false) {
|
||||
const env = new Float64Array(Math.ceil(x.length / HOP)), hold = Math.exp(-HOP / SR / RELEASE_S);
|
||||
for (let i = 0; i < x.length; i++) { const a = Math.abs(x[i]); if (a > env[(i / HOP) | 0]) env[(i / HOP) | 0] = a; }
|
||||
for (let i = 1; i < env.length; i++) env[i] = Math.max(env[i], env[i - 1] * hold);
|
||||
if (held) for (let i = 1; i < env.length; i++) env[i] = Math.max(env[i], env[i - 1] * hold);
|
||||
return env;
|
||||
}
|
||||
const maxIndex = (a) => { let k = 0; for (let i = 1; i < a.length; i++) if (a[i] > a[k]) k = i; return k; };
|
||||
|
|
@ -93,17 +93,17 @@ export function timing(x) {
|
|||
if (!(peak >= SILENT_PEAK)) return { silent: true };
|
||||
const thr = Math.max(peak * 0.01, SILENT_PEAK);
|
||||
let onsetSample = 0; while (onsetSample < x.length && Math.abs(x[onsetSample]) < thr) onsetSample++;
|
||||
const env = envelope(x), start = Math.floor(onsetSample / HOP), end = Math.min(env.length - 1, start + Math.round(ATTACK_WINDOW_S * SR / HOP));
|
||||
const env = envelope(x, true), raw = envelope(x), start = Math.floor(onsetSample / HOP), end = Math.min(env.length - 1, start + Math.round(ATTACK_WINDOW_S * SR / HOP));
|
||||
let top = start; for (let i = start; i <= end; i++) if (env[i] > env[top]) top = i;
|
||||
const first = env[top], at = (f) => { let i = start; while (i < top && env[i] < first * f) i++; return i; };
|
||||
const i10 = at(0.1), i90 = at(0.9);
|
||||
const dt = Math.max(hopMs, (i90 - i10) * hopMs), floor = peak * 10 ** (-50 / 20);
|
||||
let last = env.length - 1; while (last > 0 && env[last] < floor) last--;
|
||||
let last = raw.length - 1; while (last > 0 && raw[last] < floor) last--;
|
||||
return {
|
||||
silent: false, onsetMs: (onsetSample / SR) * 1000, attackMs: dt, attackSlopeDbPerMs: db(0.9 / 0.1) / dt,
|
||||
resolutionLimited: i90 - i10 <= 1, attackWindowLimited: top - start > 0.9 * (end - start) && end - start > 10,
|
||||
activeStartSample: onsetSample, activeEndSample: Math.min(x.length, (last + 1) * HOP),
|
||||
peakAtMs: (maxIndex(env) * HOP / SR) * 1000, firstPeak: first, firstPeakAtMs: top * hopMs,
|
||||
peakAtMs: (maxIndex(raw) * HOP / SR) * 1000, firstPeak: first, firstPeakAtMs: top * hopMs,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue