Skip to content

feat(sfx): time a sound effect by a word of the narration, with the film's snap to a hit - #105

Merged
umiyosh merged 2 commits into
masterfrom
feat/issue-92-sfx-by-word
Nov 18, 2026
Merged

umiyosh merged 2 commits into
masterfrom
feat/issue-92-sfx-by-word

Conversation

@umiyosh

@umiyosh umiyosh commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Fixes #92. Part of #87.

Summary

A sound effect's at can now name a word of its scene's narration, and build turns it into seconds. The calculation is the one the film uses for film.word (lead + the word's time in the scene's WAV / speed). An optional offset shifts it. With "snap": "hit", it moves to the nearest kick, snare or rim hit within an eighth of a bar, as beat.snap moves the film's motion.

{ "at": { "word": "四割" }, "prompt": "paper tearing", "duration": 1 }
{ "at": { "word": "人に", "offset": 0.1, "snap": "hit" }, "prompt": "airy whoosh", "duration": 0.8 }

A number still works as before.

Why

Times copied by hand did not match the film:

Change

File Change
scripts/work.ts parseSfx accepts at: { word, offset?, snap? } and keeps it on the effect, with at: 0 until it is resolved. A missing word, or a snap that is not "hit", is refused.
scripts/words.ts resolveSfxTimes(work, script, timing)
scripts/cli.ts build resolves the times before placing the effects. sfx shows the resolved times once the narration exists, and the times as written before that.
skills/rich/SKILL.md, references/html-film.md How to time a sound effect by a word

Test

  • tests/work.test.ts: parsing, and the two refusals.
  • tests/words.test.ts:
    • The resolved time equals pageWords(...), the film's film.word, plus the offset.
    • It snaps to a hit within an eighth of a bar and not to a farther one.
    • A word the narration does not say names its scene.
  • make check passes.

@umiyosh
umiyosh merged commit 0fa8bff into master Nov 18, 2026
1 check passed
@umiyosh
umiyosh deleted the feat/issue-92-sfx-by-word branch November 18, 2026 16:13
@umiyosh umiyosh mentioned this pull request Nov 18, 2026
1 of 2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sfx: give sound effect times by word, with the film's snap to a hit

1 participant