Open source CapCut alternative.
TypeScript
feat(site): ten voice presets in the sound quality picker [rebuild]
David Le0306a63b1cd9
diff --git a/site/packages/effects-kit/src/audioFx.ts b/site/packages/effects-kit/src/audioFx.tsindex 13b0a16a..411c0a04 100644--- a/site/packages/effects-kit/src/audioFx.ts+++ b/site/packages/effects-kit/src/audioFx.ts@@ -159,30 +159,94 @@ export const SOUND_COMPRESSOR_RANGE = {export const SOUND_LIMITER_RANGE = { ceiling: { min: -20, max: -0.1 } };/** The settings a compressor or limiter opens at when its switch is turned- * on — the voice preset's numbers, since that is what the switch is for. */+ * on — the voice presets' shared numbers, since that is what the switch is for. */export const SOUND_COMPRESSOR_DEFAULT = { threshold: -18, ratio: 3, attack: 10, release: 80 };export const SOUND_LIMITER_DEFAULT = { ceiling: -1 };-/** The treatments shipped with the editor. `sound` undefined is the flat one. */-export const SOUND_PRESETS: { id: string; name: string; sound: ClipSound | undefined }[] = [- { id: "flat", name: "Flat", sound: undefined },+/** A voice preset's dynamics: the shared attack and release with its own+ * ratio and threshold, held under the −1 dB ceiling. */+const voiceDynamics = (ratio: number, threshold: number) => ({+ compressor: { ...SOUND_COMPRESSOR_DEFAULT, ratio, threshold },+ limiter: SOUND_LIMITER_DEFAULT,+});++/**+ * The treatments shipped with the editor. `sound` undefined is the flat one.+ * `character` is the one-line description the picker and the chat catalog+ * both read, so the two describe a preset the same way.+ */+export const SOUND_PRESETS: {+ id: string;+ name: string;+ character: string;+ sound: ClipSound | undefined;+}[] = [+ { id: "flat", name: "Flat", character: "Untouched", sound: undefined },{id: "clear-voice",name: "Clear voice",- sound: {- eq: [2, 1, -2, -1, 1.5, 1, -1],- compressor: SOUND_COMPRESSOR_DEFAULT,- limiter: SOUND_LIMITER_DEFAULT,- },+ character: "Warm, clear podcast voice",+ sound: { eq: [2, 1, -2, -1, 1.5, 1, -1], ...voiceDynamics(3, -18) },+ },+ {+ id: "warm-rich",+ name: "Warm & Rich",+ character: "Deep, smooth, expensive-sounding",+ sound: { eq: [2, 1, -2, -1, 0.5, 1, -1], ...voiceDynamics(3, -18) },+ },+ {+ id: "crisp-clear",+ name: "Crisp & Clear",+ character: "Bright, clean, highly intelligible",+ sound: { eq: [-1.5, -1, -2, 0, 2, 3, 1], ...voiceDynamics(2.5, -18) },+ },+ {+ id: "broadcast",+ name: "Broadcast",+ character: "Polished podcast/radio voice, more compressed",+ sound: { eq: [1.5, 2, -2, -1, 1, 2, -0.5], ...voiceDynamics(4, -20) },+ },+ {+ id: "natural",+ name: "Natural",+ character: "Balanced, close to the real voice",+ sound: { eq: [0.5, 0, -1, 0, 1, 1, 0], ...voiceDynamics(2, -18) },+ },+ {+ id: "deep-voice",+ name: "Deep Voice",+ character: "Darker, heavier, deeper without turning muddy",+ sound: { eq: [3, 2, -2, -1, 0, 1, -2], ...voiceDynamics(3, -18) },+ },+ {+ id: "airy",+ name: "Airy",+ character: "Bright, open, modern creator voice",+ sound: { eq: [-0.5, -1, -1, 0, 1, 2, 2.5], ...voiceDynamics(2.5, -18) },},{id: "studio",name: "Studio",- sound: {- eq: [2, 1, -2, -1, 1.5, 1, -1],- compressor: { threshold: -18, ratio: 3, attack: 10, release: 80 },- limiter: { ceiling: -1 },- },+ character: "Warm, clear, controlled, professional — the talking-head default",+ sound: { eq: [1.5, 1, -2, -1, 1, 2, 0.5], ...voiceDynamics(3, -18) },+ },+ {+ id: "phone",+ name: "Phone / Lo-Fi",+ character: "Narrow, mid-heavy, phone-like; for skits, flashbacks and transitions",+ sound: { eq: [-10, -3, 1, 2, 3, 2, -9] },+ },+ {+ id: "cinematic",+ name: "Cinematic",+ character: "Warm, dark, intimate storytelling voice",+ sound: { eq: [2.5, 1, -2, -1, 0.5, 0, -2.5], ...voiceDynamics(3, -20) },+ },+ {+ id: "close-asmr",+ name: "Close / ASMR",+ character: "Intimate, close, detailed",+ sound: { eq: [2.5, 2, -1, 0, 1, 1, 1.5], ...voiceDynamics(3, -20) },},];diff --git a/site/src/cut/components/Inspector.tools.ts b/site/src/cut/components/Inspector.tools.tsindex d6598f56..a8d9aafb 100644--- a/site/src/cut/components/Inspector.tools.ts+++ b/site/src/cut/components/Inspector.tools.ts@@ -188,7 +188,7 @@ export const INSPECTOR_TOOLS = [{clipId: str("Video clip id or soundtrack clip id"),preset: str(- `A preset by name or id: shipped are ${SOUND_PRESETS.map((p) => `"${p.name}" (${p.id})`).join(", ")}, plus whatever the user has saved. "Clear voice" is the podcast/voice treatment: warmth below 200 Hz, mud pulled out at 400 Hz, presence at 3–5 kHz, 3:1 compression at −18 dB and a −1 dB ceiling. "Studio" is the studio voice treatment with the same shape. "Off" leaves the clip's sound as it came.`+ `A preset by name or id, plus whatever the user has saved. Shipped: ${SOUND_PRESETS.filter((p) => p.sound).map((p) => `"${p.name}" (${p.id}) — ${p.character}`).join("; ")}. "Off" (flat) leaves the clip's sound as it came.`),clear: {type: "array",diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.tsindex 918e924a..dd67e3d0 100644--- a/site/src/cut/server/ai/catalog.ts+++ b/site/src/cut/server/ai/catalog.ts@@ -18,7 +18,7 @@ import {MIN_WORDS_PER_CUE,} from "@/cut/lib/cueChunk";import { CAPTION_STYLES } from "@/cut/lib/subtitles";-import { wordEffectCatalog, WORD_EFFECT_IDS } from "@donkeycut/effects-kit";+import { SOUND_PRESETS, wordEffectCatalog, WORD_EFFECT_IDS } from "@donkeycut/effects-kit";import { textMoveCatalog } from "@/cut/lib/textMotion";import { OVERLAY_ANIMATION_TOOLS } from "@/cut/components/AnimationTiles.tools";import { AUDIO_TOOLS } from "@/cut/components/AudioPanel.tools";@@ -324,7 +324,7 @@ ${textMoveCatalog()}Lyrics and scripts the user already has: sync_lyrics times their exact words against the audio (transcribing first when needed) and writes them to a caption track with per-word timings; set_caption_look then dresses the track — preset, size, font, word effect, accent color — from a text-videos look id or field by field. The text-videos skill has the whole flow, including turning the same timed lines into full-frame cards.Soundtrack clips: volume 0..3 (1 = unchanged, above 1 boosts), fadeIn/fadeOut seconds (max half the clip), start = timeline position, in/out = trim inside the source; clips can spread across several soundtrack lanes (the \`lane\` field), new sounds slide to free space in their lane. Fades render with ffmpeg afade on export.Ducking: a soundtrack clip's \`duck\` (0..1, via update_audio) lowers ALL other audio — video-clip sound and other music — to that gain while the clip plays; 1 clears it. Voiceovers set this so narration sits over quieter music. It applies in both the preview and the export.-Sound quality (set_clip_sound): a clip's own treatment — video clip or soundtrack clip — in three stages the Inspector's Audio tab shows as Sound quality: a ${SOUND_EQ_BANDS.length}-band equalizer (${SOUND_EQ_BANDS.map((b) => b.label).join(", ")}; dB per band), a compressor (threshold dB, ratio, attack ms, release ms) and a limiter (dBFS ceiling). It runs on that clip alone, before its fades and any ducking, in the preview and every export. "Make the voice clearer / more podcast-like / less muddy / more even in level / stop it clipping" is this tool: \`preset: "clear-voice"\` is the shipped voice treatment (warmth under 200 Hz, mud out at 400 Hz, presence at 3–5 kHz, 3:1 at −18 dB, −1 dB ceiling) and \`preset: "studio"\` is the studio voice treatment with the same shape; \`preset: "flat"\` clears it; the user's own saved presets apply by name; or set the stages directly, null clearing one. save_sound_preset stores a clip's treatment in the Library under a name for reuse. A treatment shapes one clip's sound; an effect element treats a stretch of the mix.+Sound quality (set_clip_sound): a clip's own treatment — video clip or soundtrack clip — in three stages the Inspector's Audio tab shows as Sound quality: a ${SOUND_EQ_BANDS.length}-band equalizer (${SOUND_EQ_BANDS.map((b) => b.label).join(", ")}; dB per band), a compressor (threshold dB, ratio, attack ms, release ms) and a limiter (dBFS ceiling). It runs on that clip alone, before its fades and any ducking, in the preview and every export. "Make the voice clearer / more podcast-like / less muddy / more even in level / stop it clipping" is this tool: pick the shipped preset whose character fits the ask — ${SOUND_PRESETS.filter((p) => p.sound).map((p) => `\`${p.id}\` (${p.character})`).join(", ")} — with \`studio\` as the default for a talking-head voice; \`preset: "flat"\` clears it; the user's own saved presets apply by name; or set the stages directly, null clearing one. save_sound_preset stores a clip's treatment in the Library under a name for reuse. A treatment shapes one clip's sound; an effect element treats a stretch of the mix.Cutting to music: detect_beats reads a track's beat grid once — bpm plus every beat, with timeline times through the clip you pass — and the grid stays on the asset as yellow dots the user can drag, add (⌥-click the bar), or delete, with every drag and trim snapping to them. Land cuts, clip starts, and text entrances on those times: split_at at the timeline beats, or place each item to start on one.Audio effects (add_effect): the treatments over the sound — ${AUDIO_EFFECT_IDS.join(", ")} — placed on the timeline as elements, each treating everything audible under its window at once. Reach for one when the ask is how a stretch SOUNDS ("make this line sound like a phone call", "echo on that word", "muffle the music behind the voiceover"); \`amount\` says how far the treatment goes, and the effect trims and moves like any element. Loudness, fades and ducking on one clip stay with the audio tools; a dissolve across a cut stays with the transition on that cut (the audiocross style).Voiceover (Donkey's hosted speech model — signed in, spends credits, like image/video generation):