mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-12 15:20:13 +00:00
feat(core): land the plain-language layer, and test that it covers the rack (#3184)
* fix(studio): drop the unused DomEditSelection import in PropertyPanelFlat CI caught it on PR #3026 (wa-12-panel-params); a later refactor in the stack removed the last use of the type here without removing the import. * fix(studio): close the typecheck and fallow gaps wa-18b-reschedule opened useAutomationLanes.ts's write() assumed gesture-scoped coalescing and a preview-only commit that useDomEditAttributeCommits.ts never grew — backported that option support from its own later commit so the two sides of the API agree. The paste path and its tests were missing the box selection's v0/v1 bounds a sibling commit added to AutomationSelection. The FX panel's carve controls still edited the six mechanism numbers (maxCutDb, bands, intelligibilityBias) after carveProfile() collapsed authoring to one Strength knob, so those fields no longer existed on HfCarveSettings; UI now edits strength, and analyseCarveBands is called with carveProfile(strength). Also closes fallow's complexity, dead-code and duplication findings on this PR's diff: extracted automationLaneDragMath.ts (pure group/point-move math) and useAutomationRangeDrag.ts (the marquee-select gesture) out of useAutomationLaneGestures.ts, pulled a couple of render-loop ternaries and a resolver into named functions, dropped an export nothing outside its file used, and shared a step-simplifier between audioCarve's two envelope builders. The edge-stretch vs. box-select priority test in TimelineAutomationLane.test was still pinning the pre-box-select rule (edge wins over a point sitting on it) that a sibling commit deliberately reversed — a point inside the box is now selected content, so grabbing it drags the group instead. Updated the test to the shipped rule instead of the old one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(core): cap the via conic's weight so an edge-clamped via point can't NaN A via point pulled out past the segment (viaX: 5, viaY: -3) clamps to (0.999, 0.001) — exactly on the steady region's edge, where edge - viaX is 0. viaConic divided by that zero to get an infinite weight, and shapeVia turned Infinity into NaN a few steps later (Infinity - Infinity in the quadratic coefficient). NaN reaching setValueCurveAtTime silences the automated parameter for the rest of the render. Capped the weight at 1e6 instead of leaving it unbounded — past that point the arc already reads as touching the via point, so nothing visible is lost. Also hardened shapeVia's existing denominator guard (`<= 0`) to `!(> 0)`, since NaN fails the original comparison and fell through it. Review by Miga (PR #3208). * fix(studio-server): fingerprint the proactive waveform cache key too The route already keys the waveform cache on the asset's size and mtime as well as its path, so a rebuilt-in-place file gets fresh peaks instead of stale ones. generateWaveformCache — the proactive path that runs on upload — still called buildWaveformCacheKey with the path alone, so it wrote to a different key than the route reads from (making the pre-generated cache never found) and kept the exact collision bug this fingerprint exists to fix on its own path. Review by Miga (PR #3211). * style(docs): run oxfmt on the /hyperframes-audio skill docs Table column widths had drifted out of alignment with oxfmt's own rules, failing format:check and blocking the Preflight gate every downstream branch inherits. Whitespace only, no content change. * fix(core): stop \b from missing underscore-separated names, guard clipsOverlap's negative duration \b treats `_` as a word character, so \bbed\b never matched bed_01, music_bed_loop, or theme_song, and \bvo\b/\bvox\b/\btts\b had the same gap — an underscore-separated bed classified as "unknown" and could end up offered as its own carve source. Replaced the short hints with a boundary that actually excludes letters and digits on both sides. clipsOverlap computed end = start + duration without guarding sign, so a negative duration put end before start — an interval that does not describe anything, and one specific case showed it silently dropping a real overlap (a shorter, earlier broken end rejected a clip that genuinely contained the point). Duration clamps to zero instead: a clip cannot un-play time, and a zero-length clip at its start is the sane reading of "duration nobody wrote down as positive." Review by Miga (PR #3212). * fix(studio): widen PropertyPanel's resetModules render timeout again The 20s margin (already once widened for the same reason) is timing out in CI's full-monorepo Test run — the resetModules()+fresh-import render this test needs is uncached and competes with every other package's test suite for the same worker pool, and the same test passes in well under 2s standalone. Went to 45s rather than re-tuning to whatever number happens to clear the current CI load, since that number moves every time CI gains a package. * fix(studio): stop the single-candidate auto-apply carve firing twice Two auto-apply effects both fire when sourceOptions.length === 1: the multi-candidate effect only guards length === 0, so a single candidate passes it too, and the single-candidate effect passes its own guard right after — both compute the same sources list and both call setCarve, so the common case (one narrator, one bed) triggered two decodes, two FFT runs, and two concurrent attribute writes for one decision. The multi-candidate effect now defers to its sibling for exactly one candidate, which already has its own detailed handling for that case. Review by Miga (PR #3213). * feat(core): carve against every voice over a bed, always (#3212) * feat(core): carve against every voice over a bed, always dynamically A bed usually runs under a whole sequence — a narrator, an interview answer, a second presenter — and carving against one of them left the others fighting it. `source` becomes `sources`, and `mixCarveSources` sums every voice onto the BED's clock before anything is measured. That is what keeps one analysis sufficient: the chain is fixed, so there is no per-voice filter to switch between, and bands drawn from all the speech there is with envelopes that rise wherever any of it happens answer the actual question — where and when is speech masking this bed. Summed rather than averaged: two people talking at once mask more than either alone. Audio before the bed starts is dropped rather than folded in at zero, since it plays over nothing and shifting it would put a cut where there is no voice. `dynamic` is gone. A fixed depth thins the bed through every pause, and once both have been heard there is no reason to want it, so every carve follows the speech. Two helpers the panel and the headless script now share instead of each carrying a copy — two definitions of "what does this name suggest" drift, and then the two disagree about which track is the voice: - `classifyAudioName` reads a track's kind from its id and filename together. `unknown` is deliberately common: treating an unrecognised name as "not a voice" would hide the one track somebody needs to pick. - `clipsOverlap` keeps out a voice that never plays while the bed does. An unwritten duration counts as unbounded, not zero — refusing a clip whose length the composition leaves to the media would drop the commonest case there is. Files written before this still load: a single `source` reads as a one-voice list, a stored `dynamic` is ignored, and an absent attribute means the defaults whole. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(core): stop \b from missing underscore-separated names, guard clipsOverlap's negative duration \b treats `_` as a word character, so \bbed\b never matched bed_01, music_bed_loop, or theme_song, and \bvo\b/\bvox\b/\btts\b had the same gap — an underscore-separated bed classified as "unknown" and could end up offered as its own carve source. Replaced the short hints with a boundary that actually excludes letters and digits on both sides. clipsOverlap computed end = start + duration without guarding sign, so a negative duration put end before start — an interval that does not describe anything, and one specific case showed it silently dropping a real overlap (a shorter, earlier broken end rejected a clip that genuinely contained the point). Duration clamps to zero instead: a clip cannot un-play time, and a zero-length clip at its start is the sane reading of "duration nobody wrote down as positive." Review by Miga (PR #3212). --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(studio): port the carve UI off the removed source/dynamic fields #3212 (accidentally squash-merged into this branch instead of main) changed HfCarveSettings from a single `source` + `dynamic` toggle to a `sources` list with dynamic mode removed outright — the multi-voice UI consumer that goes with that shape lands in the very next PR, so this branch was left with a type that no longer matched its own code. Minimal port, not the multi-voice redesign that PR does properly: the "Listen to" picker and analyse() treat sources[0] as the one voice this UI still understands, and every dynamic-mode branch (the automated envelope lanes, the toggle, the checkbox) is gone along with the field — a carve is now always the static value the analysis computes, matching what the type change made permanent. Test suite trimmed the same way: the automation-lane and toggle tests covered behavior that no longer exists. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b839dbd2cc
commit
27cdd4d5b1
@@ -98,6 +98,12 @@
|
||||
"types": "./dist/audioFx.d.ts",
|
||||
"environments": ["browser", "bun", "node"]
|
||||
},
|
||||
"./audio-fx-copy": {
|
||||
"source": "./src/audioFxCopy.ts",
|
||||
"runtime": "./dist/audioFxCopy.js",
|
||||
"types": "./dist/audioFxCopy.d.ts",
|
||||
"environments": ["browser", "bun", "node"]
|
||||
},
|
||||
"./audio-fx-eq": {
|
||||
"source": "./src/audioFxEq.ts",
|
||||
"runtime": "./dist/audioFxEq.js",
|
||||
|
||||
@@ -112,6 +112,12 @@
|
||||
"import": "./src/audioFx.ts",
|
||||
"types": "./src/audioFx.ts"
|
||||
},
|
||||
"./audio-fx-copy": {
|
||||
"bun": "./src/audioFxCopy.ts",
|
||||
"node": "./dist/audioFxCopy.js",
|
||||
"import": "./src/audioFxCopy.ts",
|
||||
"types": "./src/audioFxCopy.ts"
|
||||
},
|
||||
"./audio-fx-eq": {
|
||||
"bun": "./src/audioFxEq.ts",
|
||||
"node": "./dist/audioFxEq.js",
|
||||
@@ -420,6 +426,10 @@
|
||||
"import": "./dist/audioFx.js",
|
||||
"types": "./dist/audioFx.d.ts"
|
||||
},
|
||||
"./audio-fx-copy": {
|
||||
"import": "./dist/audioFxCopy.js",
|
||||
"types": "./dist/audioFxCopy.d.ts"
|
||||
},
|
||||
"./audio-fx-eq": {
|
||||
"import": "./dist/audioFxEq.js",
|
||||
"types": "./dist/audioFxEq.d.ts"
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { defaultAudioFxParams, HF_AUDIO_FX } from "./audioFx.js";
|
||||
import { HF_AUDIO_FX_PRESETS } from "./audioFxPresets.js";
|
||||
import { BANDS, EFFECT_COPY, PRESET_PROBLEM, SUMMARY } from "./audioFxCopy.js";
|
||||
|
||||
/**
|
||||
* The copy layer is only worth having if it covers everything that ships. A gap
|
||||
* is not a missing nicety — it is a rack panel labelled `highpass` in front of
|
||||
* somebody who came here to stop a hum, which is the exact failure this layer
|
||||
* exists to prevent.
|
||||
*
|
||||
* This was a build step in `plans/audio-fx-ux/build-preview.mts`, which meant it
|
||||
* only caught a gap when somebody remembered to rebuild the review page. Here it
|
||||
* catches it on the commit that adds the effect.
|
||||
*/
|
||||
describe("every shipped effect has plain-language copy", () => {
|
||||
for (const def of HF_AUDIO_FX) {
|
||||
it(`${def.id}`, () => {
|
||||
const copy = EFFECT_COPY[def.id];
|
||||
expect(copy, `${def.id} has no copy`).toBeDefined();
|
||||
if (!copy) return;
|
||||
for (const param of def.params) {
|
||||
expect(copy.params[param.key], `${def.id}.${param.key} has no plain name`).toBeDefined();
|
||||
}
|
||||
// "strength" is the one legal fiction: it means the module gets a single
|
||||
// derived knob and its real parameters live behind Details. Anything else
|
||||
// has to name a parameter the effect actually has, or the panel would put
|
||||
// its headline control on a knob that does not exist.
|
||||
if (copy.primary !== "strength") {
|
||||
expect(
|
||||
def.params.map((p) => p.key),
|
||||
`${def.id}'s primary "${copy.primary}" is not one of its parameters`,
|
||||
).toContain(copy.primary);
|
||||
}
|
||||
expect(SUMMARY[def.id], `${def.id} has no closed-state summary`).toBeDefined();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("every preset says which everyday problem it answers", () => {
|
||||
const missing = HF_AUDIO_FX_PRESETS.filter((p) => !PRESET_PROBLEM[p.id]).map((p) => p.id);
|
||||
expect(missing).toEqual([]);
|
||||
});
|
||||
|
||||
it("describes no effect the registry does not ship", () => {
|
||||
const shipped = new Set(HF_AUDIO_FX.map((d) => d.id));
|
||||
// The other direction. Copy for an effect that has been removed or renamed is
|
||||
// dead text that reads as covered, and the count in the review page would say
|
||||
// so too.
|
||||
expect(Object.keys(EFFECT_COPY).filter((id) => !shipped.has(id))).toEqual([]);
|
||||
expect(Object.keys(SUMMARY).filter((id) => !shipped.has(id))).toEqual([]);
|
||||
});
|
||||
|
||||
it("summarises every effect at its own defaults without throwing", () => {
|
||||
for (const def of HF_AUDIO_FX) {
|
||||
const summary = SUMMARY[def.id];
|
||||
if (!summary) continue;
|
||||
// The first thing an author reads after adding an effect, so it has to be a
|
||||
// sentence at the values it arrives with — not "undefined dB".
|
||||
const text = summary(defaultAudioFxParams(def.id));
|
||||
expect(text, `${def.id} summarised as "${text}"`).toMatch(/^[^u].*[^ ]$/);
|
||||
expect(text).not.toContain("undefined");
|
||||
expect(text).not.toContain("NaN");
|
||||
}
|
||||
});
|
||||
|
||||
it("covers the spectrum without a gap or an overlap", () => {
|
||||
// The ruler is shared by every spectral module, so a hole in it is a frequency
|
||||
// the rack can name in one place and not in another.
|
||||
expect(BANDS[0]?.from).toBe(20);
|
||||
expect(BANDS.at(-1)?.to).toBe(20000);
|
||||
for (let i = 1; i < BANDS.length; i++) {
|
||||
expect(BANDS[i]?.from, `gap or overlap before ${BANDS[i]?.name}`).toBe(BANDS[i - 1]?.to);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,375 @@
|
||||
/**
|
||||
* The plain-language layer over the effect registry.
|
||||
*
|
||||
* Every entry is written for somebody who has never opened a mixer. The rule
|
||||
* used throughout: name the OUTCOME, never the mechanism, and describe a control
|
||||
* by what changes in the sound rather than what it does to the signal.
|
||||
*
|
||||
* This is a layer *over* the registry, not a replacement for it. `HF_AUDIO_FX`
|
||||
* stays the authority on what an effect is and what its parameters do; this says
|
||||
* what to call those things in front of an author. `audioFxCopy.test.ts` holds
|
||||
* the two together — every shipped effect, every one of its parameters, and
|
||||
* every preset must have an entry here, so adding one to the registry without
|
||||
* copy fails a test rather than shipping a rack panel labelled `highpass`.
|
||||
*
|
||||
* Tone and the levelling module are deliberately absent: both carry their own
|
||||
* copy in core already (`audioEqSummary`, `levellingSummary`), because a summary
|
||||
* that has to read the chain belongs beside the code that writes it.
|
||||
*
|
||||
* Design rationale, and the review page built from this, in
|
||||
* `plans/audio-fx-ux/README.md`.
|
||||
*/
|
||||
|
||||
export interface Ends {
|
||||
/** What the low end of the control sounds like. */
|
||||
low: string;
|
||||
high: string;
|
||||
}
|
||||
|
||||
export interface ParamCopy {
|
||||
label: string;
|
||||
hint?: string;
|
||||
ends?: Ends;
|
||||
}
|
||||
|
||||
export interface EffectCopy {
|
||||
/** What the module is called in the rack. Never the DSP name. */
|
||||
title: string;
|
||||
/** One line: what it is for. Present tense, second person implied. */
|
||||
does: string;
|
||||
/** The problem an author would say out loud that leads here. */
|
||||
reachFor: string;
|
||||
/**
|
||||
* The single control that carries the module. Either a real parameter key,
|
||||
* or "strength" — meaning the module gets one derived knob and the real
|
||||
* parameters live behind Details.
|
||||
*/
|
||||
primary: string;
|
||||
primaryEnds: Ends;
|
||||
/** Plain names for the real parameters, shown only under Details. */
|
||||
params: Record<string, ParamCopy>;
|
||||
/** Which frequencies it acts on, for the shared ruler. Omit if not spectral. */
|
||||
band?: [number, number];
|
||||
}
|
||||
|
||||
export const EFFECT_COPY: Record<string, EffectCopy> = {
|
||||
gain: {
|
||||
title: "Volume",
|
||||
does: "Turns this track up or down.",
|
||||
reachFor: "It's too loud, or too quiet, against everything else.",
|
||||
primary: "gain",
|
||||
primaryEnds: { low: "Silent", high: "Louder" },
|
||||
params: { gain: { label: "Level", ends: { low: "Silent", high: "Louder" } } },
|
||||
},
|
||||
highpass: {
|
||||
title: "Remove Rumble",
|
||||
does: "Cuts the very bottom — traffic, footsteps, air conditioning, hands on the mic.",
|
||||
reachFor: "There's a low hum or thump under everything.",
|
||||
primary: "frequency",
|
||||
primaryEnds: { low: "Only the deepest", high: "Thins the voice out" },
|
||||
band: [20, 300],
|
||||
params: {
|
||||
frequency: {
|
||||
label: "Cut below",
|
||||
hint: "Everything under this is removed.",
|
||||
ends: { low: "Only the deepest", high: "Thins the voice out" },
|
||||
},
|
||||
q: { label: "Sharpness", hint: "How abruptly the cut starts." },
|
||||
poles: { label: "Steepness", hint: "How fast it falls away below the point." },
|
||||
},
|
||||
},
|
||||
lowpass: {
|
||||
title: "Muffle",
|
||||
does: "Takes the top off, like the sound is coming through a door.",
|
||||
reachFor: "You want something to sound distant, or behind something else.",
|
||||
primary: "frequency",
|
||||
primaryEnds: { low: "Very muffled", high: "Barely changed" },
|
||||
band: [1000, 20000],
|
||||
params: {
|
||||
frequency: { label: "Cut above", ends: { low: "Very muffled", high: "Barely changed" } },
|
||||
q: { label: "Sharpness" },
|
||||
poles: { label: "Steepness" },
|
||||
},
|
||||
},
|
||||
peaking: {
|
||||
title: "Shape One Range",
|
||||
does: "Lifts or lowers one part of the sound and leaves the rest alone.",
|
||||
reachFor: "One quality is wrong — boomy, boxy, harsh — but the rest is fine.",
|
||||
primary: "gain",
|
||||
primaryEnds: { low: "Take it out", high: "Bring it forward" },
|
||||
band: [20, 20000],
|
||||
params: {
|
||||
frequency: { label: "Where", hint: "Which part of the sound to change." },
|
||||
gain: { label: "How much", ends: { low: "Take it out", high: "Bring it forward" } },
|
||||
q: {
|
||||
label: "How wide",
|
||||
hint: "A narrow setting fixes one note; a wide one changes the whole character.",
|
||||
},
|
||||
},
|
||||
},
|
||||
lowshelf: {
|
||||
title: "Bass",
|
||||
does: "More or less weight underneath everything.",
|
||||
reachFor: "It sounds thin, or too heavy.",
|
||||
primary: "gain",
|
||||
primaryEnds: { low: "Thinner", high: "Heavier" },
|
||||
band: [20, 300],
|
||||
params: {
|
||||
frequency: { label: "Up to", hint: "Everything below this is lifted or dropped." },
|
||||
gain: { label: "How much", ends: { low: "Thinner", high: "Heavier" } },
|
||||
},
|
||||
},
|
||||
highshelf: {
|
||||
title: "Brightness",
|
||||
does: "More or less sparkle at the top.",
|
||||
reachFor: "It sounds dull, or too fizzy.",
|
||||
primary: "gain",
|
||||
primaryEnds: { low: "Duller", high: "Brighter" },
|
||||
band: [2000, 20000],
|
||||
params: {
|
||||
frequency: { label: "From", hint: "Everything above this is lifted or dropped." },
|
||||
gain: { label: "How much", ends: { low: "Duller", high: "Brighter" } },
|
||||
},
|
||||
},
|
||||
compressor: {
|
||||
title: "Even Out Loudness",
|
||||
does: "Brings the quiet parts up and holds the loud parts down, so nothing jumps out at the listener.",
|
||||
reachFor: "Some words are much louder than others.",
|
||||
primary: "strength",
|
||||
primaryEnds: { low: "Barely touched", high: "Very even, quite squashed" },
|
||||
params: {
|
||||
threshold: { label: "Starts working at", hint: "Anything louder than this gets held down." },
|
||||
ratio: { label: "How hard", hint: "How much of the excess is removed." },
|
||||
attack: { label: "How fast it grabs", ends: { low: "Instant", high: "Lets peaks through" } },
|
||||
release: { label: "How fast it lets go", ends: { low: "Snappy", high: "Smooth" } },
|
||||
knee: { label: "How gradual" },
|
||||
makeup: {
|
||||
label: "Volume back up",
|
||||
hint: "Compression makes things quieter; this puts the level back.",
|
||||
},
|
||||
mix: { label: "Blend with the original" },
|
||||
},
|
||||
},
|
||||
limiter: {
|
||||
title: "Peak Ceiling",
|
||||
does: "Nothing gets louder than this, ever. A safety net at the end of the chain.",
|
||||
reachFor: "You want to be sure it never clips or spikes.",
|
||||
primary: "limit",
|
||||
primaryEnds: { low: "A lot of headroom", high: "Right up to the edge" },
|
||||
params: {
|
||||
limit: {
|
||||
label: "Never exceed",
|
||||
ends: { low: "A lot of headroom", high: "Right up to the edge" },
|
||||
},
|
||||
attack: { label: "How fast it catches" },
|
||||
release: { label: "How fast it recovers" },
|
||||
level_out: { label: "Level after" },
|
||||
},
|
||||
},
|
||||
gate: {
|
||||
title: "Silence the Gaps",
|
||||
does: "Mutes the pauses between words. Room tone under speech stays — this closes the silences, it does not remove noise.",
|
||||
reachFor: "You can hear the room breathing between sentences.",
|
||||
primary: "strength",
|
||||
primaryEnds: { low: "Only true silence", high: "Cuts quiet words too" },
|
||||
params: {
|
||||
threshold: { label: "Quieter than this is a gap" },
|
||||
range: {
|
||||
label: "How far to duck the gaps",
|
||||
hint: "Not all the way down, usually — total silence sounds broken.",
|
||||
},
|
||||
ratio: { label: "How hard" },
|
||||
attack: { label: "How fast it opens" },
|
||||
release: {
|
||||
label: "How fast it closes",
|
||||
ends: { low: "Clips word endings", high: "Leaves tails intact" },
|
||||
},
|
||||
knee: { label: "How gradual" },
|
||||
},
|
||||
},
|
||||
saturate: {
|
||||
title: "Warmth",
|
||||
does: "Adds a little grit and density, the way analogue gear does.",
|
||||
reachFor: "It sounds clean but lifeless.",
|
||||
primary: "strength",
|
||||
primaryEnds: { low: "Just a sheen", high: "Openly distorted" },
|
||||
params: {
|
||||
type: {
|
||||
label: "Character",
|
||||
hint: "Different flavours of the same idea. Tanh is the gentle one.",
|
||||
},
|
||||
threshold: {
|
||||
label: "How much drive",
|
||||
ends: { low: "Just a sheen", high: "Openly distorted" },
|
||||
},
|
||||
output: { label: "Level after", hint: "Drive makes things louder; this puts it back." },
|
||||
oversample: { label: "Quality", hint: "Higher costs more but sounds cleaner." },
|
||||
},
|
||||
},
|
||||
bitcrush: {
|
||||
title: "Lo-Fi",
|
||||
does: "Crushes the sound down to fewer steps, like an old sampler or a bad phone line.",
|
||||
reachFor: "You want it to sound cheap or digital on purpose.",
|
||||
primary: "strength",
|
||||
primaryEnds: { low: "Slightly gritty", high: "Destroyed" },
|
||||
params: {
|
||||
bits: { label: "How many steps", ends: { low: "Destroyed", high: "Clean" } },
|
||||
samples: {
|
||||
label: "How rough",
|
||||
hint: "Holds each value for longer, which dulls and grits it.",
|
||||
},
|
||||
mix: { label: "Blend with the original" },
|
||||
},
|
||||
},
|
||||
delay: {
|
||||
title: "Echo",
|
||||
does: "Repeats the sound after a gap.",
|
||||
reachFor: "You want space, or a rhythmic effect.",
|
||||
primary: "mix",
|
||||
primaryEnds: { low: "A hint", high: "Washed out" },
|
||||
params: {
|
||||
time: { label: "Gap between repeats" },
|
||||
feedback: { label: "How many repeats", ends: { low: "One", high: "Trails away for ages" } },
|
||||
mix: { label: "How loud", ends: { low: "A hint", high: "Washed out" } },
|
||||
},
|
||||
},
|
||||
reverb: {
|
||||
title: "Room",
|
||||
does: "Puts the sound somewhere, instead of nowhere.",
|
||||
reachFor: "It sounds dry and stuck to the speaker.",
|
||||
primary: "strength",
|
||||
primaryEnds: { low: "A small tight room", high: "A big open hall" },
|
||||
params: {
|
||||
size: { label: "How big the space is" },
|
||||
damping: {
|
||||
label: "How soft the walls are",
|
||||
ends: { low: "Hard and bright", high: "Soft and dark" },
|
||||
},
|
||||
wet: { label: "How much room" },
|
||||
dry: { label: "How much original" },
|
||||
},
|
||||
},
|
||||
chorus: {
|
||||
title: "Thicken",
|
||||
does: "Doubles the sound slightly out of tune, which makes it wider and less exact.",
|
||||
reachFor: "It sounds thin or too plain on its own.",
|
||||
primary: "mix",
|
||||
primaryEnds: { low: "Just wider", high: "Obviously wobbling" },
|
||||
params: {
|
||||
delay: { label: "Spread" },
|
||||
depth: { label: "How much wobble" },
|
||||
speed: { label: "How fast it wobbles" },
|
||||
mix: { label: "How much", ends: { low: "Just wider", high: "Obviously wobbling" } },
|
||||
},
|
||||
},
|
||||
phaser: {
|
||||
title: "Swirl",
|
||||
does: "A filter that sweeps up and down, giving a moving, hollow shimmer.",
|
||||
reachFor: "You want movement, or a 1970s flavour.",
|
||||
primary: "out_gain",
|
||||
primaryEnds: { low: "Subtle", high: "Strong" },
|
||||
params: {
|
||||
in_gain: { label: "Depth in" },
|
||||
out_gain: { label: "How strong", ends: { low: "Subtle", high: "Strong" } },
|
||||
delay: { label: "Where it sweeps" },
|
||||
decay: { label: "How resonant" },
|
||||
speed: { label: "How fast it sweeps" },
|
||||
type: { label: "Shape of the sweep" },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The shared vocabulary. Frequencies mean nothing to somebody who has not been
|
||||
* taught them; these words are what the same person would say unprompted, and
|
||||
* naming the ranges once teaches them everywhere they appear.
|
||||
*/
|
||||
export const BANDS: { from: number; to: number; name: string; says: string }[] = [
|
||||
{ from: 20, to: 80, name: "Rumble", says: "traffic, footsteps, handling" },
|
||||
{ from: 80, to: 250, name: "Weight", says: "chest, body, warmth" },
|
||||
{ from: 250, to: 600, name: "Mud", says: "boxy, muffled, cardboard" },
|
||||
{ from: 600, to: 2000, name: "Middle", says: "the body of a voice" },
|
||||
{ from: 2000, to: 5000, name: "Presence", says: "consonants, intelligibility" },
|
||||
{ from: 5000, to: 10000, name: "Edge", says: "sibilance, harshness" },
|
||||
{ from: 10000, to: 20000, name: "Air", says: "sparkle, openness" },
|
||||
];
|
||||
|
||||
/** Which everyday complaint each preset answers. Presets ARE the product here. */
|
||||
export const PRESET_PROBLEM: Record<string, string> = {
|
||||
"voice-clean": "My voice sounds amateur",
|
||||
"voice-broadcast": "I want it to sound like radio",
|
||||
"voice-warm": "I want it intimate and close",
|
||||
"rumble-cut": "There's a hum or thump underneath",
|
||||
"room-gate": "I can hear the room between sentences",
|
||||
"boom-tame": "My voice sounds boomy",
|
||||
"harsh-tame": "It's harsh and tiring to listen to",
|
||||
telephone: "Make it sound like a phone call",
|
||||
"radio-am": "Make it sound like an old radio",
|
||||
megaphone: "Make it sound shouted through a horn",
|
||||
"lofi-tape": "Make it sound like an old tape",
|
||||
"pa-system": "Make it sound like a station announcement",
|
||||
intercom: "Make it sound like a door intercom",
|
||||
"room-tight": "It sounds dry and stuck to the speaker",
|
||||
"room-natural": "It should sound like a real place",
|
||||
hall: "It should sound far away and big",
|
||||
"slap-echo": "I want one quick echo",
|
||||
"dub-throw": "I want long trailing echoes",
|
||||
};
|
||||
|
||||
/**
|
||||
* What a module says when it is CLOSED.
|
||||
*
|
||||
* The most-seen state by a distance: a rack with six modules is six of these
|
||||
* and nothing else. So it is a sentence about what is happening to the sound,
|
||||
* not a dump of the parameter that happens to be first. An author should be
|
||||
* able to read the rack top to bottom and understand their own mix.
|
||||
*
|
||||
* Numbers stay in — they are what makes it checkable rather than vague — but
|
||||
* they arrive inside a phrase instead of on their own.
|
||||
*/
|
||||
type P = Record<string, unknown>;
|
||||
const n = (v: unknown, fallback = 0) => (typeof v === "number" ? v : fallback);
|
||||
const hz = (v: unknown) => {
|
||||
const x = n(v);
|
||||
return x >= 1000 ? `${(x / 1000).toFixed(x % 1000 === 0 ? 0 : 1)} kHz` : `${Math.round(x)} Hz`;
|
||||
};
|
||||
const strength = (x: number, words: [string, string, string]) =>
|
||||
x < 0.34 ? words[0] : x < 0.67 ? words[1] : words[2];
|
||||
|
||||
export const SUMMARY: Record<string, (p: P) => string> = {
|
||||
gain: (p) =>
|
||||
n(p.gain) === 0
|
||||
? "No change"
|
||||
: n(p.gain) > 0
|
||||
? `Up ${n(p.gain)} dB`
|
||||
: `Down ${Math.abs(n(p.gain))} dB`,
|
||||
highpass: (p) => `Cutting everything below ${hz(p.frequency)}`,
|
||||
lowpass: (p) => `Muffled above ${hz(p.frequency)}`,
|
||||
// A band at 0 dB is doing nothing, and saying "lifting by 0 dB" describes a
|
||||
// non-event as though it were a setting. Freshly added effects sit exactly
|
||||
// here, so this is the FIRST thing an author reads after adding one.
|
||||
peaking: (p) =>
|
||||
n(p.gain) === 0
|
||||
? `Sitting on ${hz(p.frequency)}, doing nothing yet`
|
||||
: `${n(p.gain) > 0 ? "Lifting" : "Cutting"} ${hz(p.frequency)} by ${Math.abs(n(p.gain))} dB`,
|
||||
lowshelf: (p) =>
|
||||
n(p.gain) === 0
|
||||
? "Doing nothing yet"
|
||||
: `${n(p.gain) > 0 ? "More" : "Less"} weight below ${hz(p.frequency)}`,
|
||||
highshelf: (p) =>
|
||||
n(p.gain) === 0
|
||||
? "Doing nothing yet"
|
||||
: `${n(p.gain) > 0 ? "More" : "Less"} sparkle above ${hz(p.frequency)}`,
|
||||
compressor: (p) =>
|
||||
`Evening out — ${strength(Math.min(1, (n(p.ratio, 3) - 1) / 7), ["gentle", "moderate", "firm"])}`,
|
||||
limiter: (p) => `Nothing louder than ${n(p.limit, -1)} dB`,
|
||||
gate: (p) => `Closing gaps quieter than ${n(p.threshold, -45)} dB`,
|
||||
saturate: (p) =>
|
||||
`${strength(Math.min(1, Math.abs(n(p.threshold, -6)) / 30), ["A little", "Some", "Heavy"])} warmth`,
|
||||
bitcrush: (p) => `Crushed to ${n(p.bits, 8)} bits`,
|
||||
delay: (p) => `Echo every ${n(p.time, 250)} ms`,
|
||||
reverb: (p) =>
|
||||
`${strength(n(p.size, 0.7), ["A small", "A medium", "A large"])} room, ${strength(n(p.wet, 0.35), ["lightly", "moderately", "heavily"])}`,
|
||||
chorus: (p) => `Thickened${n(p.mix, 0.5) > 0.6 ? ", wobbling" : ""}`,
|
||||
phaser: () => "Swirling",
|
||||
};
|
||||
Reference in New Issue
Block a user