Skip to content

notque/vexjoy-agent / skills/game/game-trailer

game-trailer

Verified

Make a trailer, promo, teaser, sizzle reel, launch or gameplay video for one of our browser games (Road to AEW / ROAD TO THE BIG TIME, 5 Star Booker, or any game built the same way) from the real game: frame-exact 4K capture under a virtual clock, a beat-mapped edit with poster overlays printed in the game's own CSS, a score written in code, the game's own sounds and its crowd engine. Use it whenever someone asks for a trailer, a promo or social video of a game, a YouTube or X cut, a re-cut or recapture of an existing trailer, or just 'make a video that shows the game off'. Carries the pace rules the owner settled on and the capture, edit and audio traps that cost time.

FileKindSize
SKILL.mdskill md12.9 KB
references/audio.mdmarkdown9.0 KB
references/capture.mdmarkdown10.9 KB
references/edit.mdmarkdown10.1 KB
references/lessons.mdmarkdown9.4 KB
references/pipeline.mdmarkdown11.1 KB
references/review.mdmarkdown7.7 KB
references/worked-example.mdmarkdown8.5 KB
scripts/beat_levels.pyscript5.7 KB
scripts/edl_table.pyscript6.1 KB
scripts/take_sheet.pyscript4.3 KB

references/audio.md

View on GitHub
# Audio

Three layers, all rendered offline and deterministic: the score (written in code), the game's own
sounds (logged during capture, rebuilt in sync), and the crowd (the shared crowd engine's audience
mode, rendered from its own files). `mix.py` places them, ducks, gates and masters.

## The score (`audio/compose_trailer.py`)

E minor, tempo from `timeline.json`, rendered with numpy through `scripts/audio/dsp.py`. No samples,
no third-party or generated music.

| Part | Synth |
|---|---|
| Drums | `kick` (pitch drop + click, tanh), `clap` (four noise bursts + tone + snap), `snare`, `hat` (six square partials + noise, 7.2 to 16 kHz), `crash`, `tom` |
| Bass | `bass808(midi, dur, glide_from)`: knock, glide, saturation so small speakers hear the note |
| Tonal | `stab` (brass supersaw chord, filter close), `pluck` (arp), `lead`, `pad`; chords Em C D B G with 808 roots 28 36 38 35 31 |
| Trailer | `braam` (power-chord supersaw whose filter blooms), `impact` (sub drop + thump + crack + tail), `riser(beats)`, `reverse_swell`, `blip` (slot tick), `ring_bell` (inharmonic partials) |

Arrangement rules:

- `groove(b0, b1, stabs, lead_line, rolls)` lays bars on the output grid from the drop: a stretched
  block keeps the tempo and only its hits move. Four-beat bars cycle Em C D B with per-bar kick
  patterns, claps on 2 and 4, rolling hats, a brass hook, an optional lead line.
- Sections written by hand in cut beats (the creator arp, the slot-machine blips, the half-time
  table groove) use `RAW = True` blocks or `out_beat()` so they sit on the output grid too.
- Every hit and both gaps (`gap`, `gap2`) come from `HITS` in the beat map: drop, table crash, blood, Muta stamps, weapons, tap-out,
  the signature, the crowd demand, the finisher panel and impact, the three counts, WINNER, the
  roster cards, the title, three bells.
- Risers take `span(b0, b1)` beats so they reach their hit after a stretch.
- `K()` records every kick in output beats; `dsp.sidechain_env` ducks bass, stabs, pad, arp and lead
  under them (depth 0.55, tau 70 ms).
- Gaps: from `hits.gap` to the drop and from the roulette's end to the finisher panel, everything but
  the fx bus is gated to silence (a 200-sample ramp in). The building holds its breath too (`mix.py`
  gates the crowd -16 dB over the same spans).
- `DYNAMICS` is the section loudness curve: (cut beat, dB) points, -10 dB under the creator, 0 on the
  drops. `dynamics_curve()` adds the inserted sections' points and applies it after the glue
  compressor so it survives.
- Master: mono below 120 Hz, EQ (hp 30, -1.5 at 3k, +1.5 at 1.2k, -2 shelf at 10k), peak -6, compress
  -16 dB 2:1, loudness curve, soft clip, peak -1. Stems (`drums`, `bass`, `music`, `fx`) are written
  normalized for inspection; the premix keeps the real balance.

## A new cut

The synths, the groove machinery, the mastering and the mix's plumbing carry over. The arrangement is
the cut's, keyed to the beat map's names, and a new `timeline.json` stops both scripts on a `KeyError`
until these are rewritten:

| File | Rewrite |
|---|---|
| `compose_trailer.py` | `render()`: every `HITS[...]`, `SECTIONS[...]` and `TL["inserted"][...]` reference and the hand-written sections; `DYNAMICS`; the inserted-section points in `dynamics_curve()` |
| `mix.py` | `GAPS` (the silences before the drops), `BED_CURVE` (the crowd bed through the video, in cut beats), the inserted-section bed cases; `BASE_DB` for any new cue sound |
| unchanged | synths, `groove()`, `mix()`, `master()`, `TRAILER_CROWD`, `SAMPLE_FILES`, `GAME_REPLACES`, `arena.py` |

Keep the cut-6 hit names where the moment is the same kind (a drop, a stamp, a pin count) and the
arrangement comes along for free.

## The game's own sounds

1. During capture `lib.mjs` logs every `audioSystem` call and every crowd-engine cue with the virtual
   time (`capture.md`, "The sound log").
2. `render_game_audio.mjs [take ...]` (no argument: every take on disk) turns each log into
   `tmp/promo/audio/game/<take>/events.json`:
   `sample` events keep key, volume, rate and offset (the mix rebuilds them from the game's asset files,
   tape-style rate change); `synth` events (slams, tier-ups, clicks, turn end) are replayed into an
   `OfflineAudioContext` inside the real game page and saved as PCM clips; `engine` events are the
   crowd cues.
3. `mix.py` `game_layer()` maps each event through the speed curve of every shot that shows that take
   (`shot_map`, 1 ms grid), so a sound fires at normal speed wherever its moment appears, slow motion
   included. Events that fire on a cut's first frame land up to 60 ms before the shot's source start;
   they are kept.
4. The game layer sits at `GAME_DB = +6` over the logged volume (`GAME_VOLUME 0.3` × call volume).
   Trailer cues the game now plays for real are skipped (`GAME_REPLACES`), so the hit is never doubled.

A take with no log (a poster shot, or a take captured before the log existed) falls back to the
trailer's own cue sounds (`BASE_DB` table): game samples picked by cue name, plus synthesized foley.

## The crowd engine (`audio/arena.py`)

The games run the shared crowd engine (`mmr-ratings`, `static/js/fs-match-audio.js`, branch `dev`) in
audience mode: recorded files at fixed gains, nothing synthesized. Rendering through the engine
offline lost voices (Tone.js offline context), so `arena.py` reproduces the audience mode in numpy
from the same files and the numbers read out of the engine source. Keep it in sync with that file.

| Rule | Value |
|---|---|
| Reactions (`pop`/`woo`/`entry`/`elimination`/`kickout` -> cheer, `boo`, `comeback` -> slow claps) | Level `0.55 + 0.35 i` (claps `0.35 + 0.25 i`); one at a time: a new reaction of the same kind is dropped while one plays (clips are 6 to 10 s); the bed dips to 60% for up to 3 s under it |
| Trailer liberty | A reaction of the other kind cuts in: the current one fades out over 0.25 s. The engine would drop it; the owner wanted the boo on the enemy's hit to be heard over the cheer for the player's plays |
| Effects (bell, mat contacts heavy/medium/sharp/tap, referee slap, rope rebounds, strikes punch/kick/chop/elbow/slap/stomp, steps) | Each at its dB from the FX table; at most 3 at once by rank; deduped per contact id and within 50 ms; variations alternate; the bell once |
| Chants (`this_is_awesome`, `holy_shit`) | -8 dB × (0.8 + 0.2 i), 30 s cooldown, bed at 75% under |
| Referee count (`slap` with `n`, `matSlap`) | Referee voice at 0.55, the crowd's count at 0.22 on three |
| Bed | The arena ambience loop at `0.12 + 0.13 × level`; level from `BED_CURVE` in the mix (out of the arena for the creator, a building that gets louder match by match, 0.45 to 0.6 under the full-screen turn) |
| Master | Knee-0 limiter at -1 dBFS, then the game's crowd volume (45% -> `0.45^0.8`); the mix adds `CROWD_DB = 10` and then -4 |

Cue sources in the mix: every `engine` event from the takes (strikes, contacts, bell, pops, boos
the game itself fired) plus the edit's `crowd_*` cues translated through `TRAILER_CROWD`
(`crowd_pop` -> pop 0.7, `crowd_roar` -> pop 0.95, `crowd_demands` -> pop 1.0, `crowd_boo` -> boo 0.85,
`chant_awesome` -> chant; `crowd_ooh` and `crowd_gasp` have no engine equivalent and are dropped).
`PROMO_DEBUG=1 python mix.py` prints the merged reaction list with times: read it every cut and check
each boo sits on a heel moment and each pop on the player's.

## The mix (`audio/mix.py`)

| Layer | Level | Notes |
|---|---|---|
| Score | -3.5 dB, ducked 0.45 (0.3 for `hit_heavy`) over 0.45 s under the big hits | so the game's sounds cut through |
| Trailer cues (sfx bus) | `BASE_DB[sound] + cue.gain` | impacts -7/-11, table crash -2, finisher hit -3, VS slam -9, ticks -22 |
| Game layer | +6 dB | the logged sounds at their logged volumes |
| Crowd | engine render × +10 dB, then -4 dB; -16 dB over the gaps | |
| Master | mono below 110 Hz, hp 28 Hz, compress -14 dB 1.8:1, true-peak limiter -1.3 dBTP, loudness iterated to -13 LUFS integrated | measured with ffmpeg `ebur128` |

The balance table mix.py prints (dB RMS per section, per layer, pre-master) is the ears in a session
that cannot listen. Read it as: the score leads at about -16 to -24; game and sfx reach -18 to -20 on
the impact sections; a `-180` means the layer is silent there (fine for a poster shot, a bug under a
fight); a crowd row above the music on a quiet section is a stray reaction.

## Checks that found real bugs

| Check | Command | What it caught |
|---|---|---|
| Per-beat loudness | `python "$SKILL/scripts/beat_levels.py" tmp/promo/audio/mix.wav --timeline scripts/promo/timeline.json` | the -40 dB hole from the unmapped ring-out tail; the creator bed too quiet |
| Crowd cue list | `PROMO_DEBUG=1 python scripts/promo/audio/mix.py` | an edit boo at the start of the turn swallowing the cheers for every card play |
| Balance table | printed by `mix.py` | the game layer silent on a section whose take had no events (render it), the roulette's game layer at -85 (expected: poster slots) |
| Stems | `tmp/promo/audio/mixstem-{music,sfx,game,crowd}.wav`, `stem-{drums,bass,music,fx}.wav` | play one layer alone against the contact sheet when a sound is at the wrong time |
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall