Skip to content
Source
Sign inSign up
fuko/rive-preview-player

Audio tracks and per-sound-effect levels #4

Mergedfukomerged 6 commits intomain fromfeat/audio-tracksmerged by fuko View on GitHub

fukocommented

What

The preview player gets an audio mixer for the sound effects (each AudioEvent keyframe):

  • Tracks: up to 3 audio tracks, each with a name, mute, solo, volume and remove. Removing a track moves its sounds to the track above.
  • Clips: every sound effect is a clip on its track, with its waveform drawn at the level it plays at. Click a clip to set its volume with a stepped slider (0–100% in steps of 10, with dB), apply that to every occurrence of the sound, or reset it. Drag a clip, or press ↑/↓, to move it between tracks.
  • Collapse: the tracks fold away (header toggle or A) into a ruler plus a strip of ticks, giving the stage more room.
  • Playback: a sound effect plays at asset volume × clip volume × track volume, and changes apply to sounds already playing without restarting them.
  • Saving: the mix is saved to .rive-preview/mix.json and survives reloads and rebuilds. The Rive project is never changed. Agents can read the mix with the new get_audio_mix MCP tool, and it is attached to feedback bundles.
  • Bare .riv files now get audio timing. lib/riv-audio.mjs reads the artboards, animations and AudioEvent keyframes straight from the binary, using a property-type table generated from rive schema (scripts/gen-riv-schema.mjs). On the test fixture its output is identical to rive inspect.
  • Test fixture: test-fixture-audio/ is a small project with synthetic whoosh, pop and ding sounds.

Review

Six rounds of Codex review. The issues it found and the fixes:

  • A mix fetched from the server could overwrite newer local edits. Saves now run in order, and a remote change is applied once local saves finish.
  • Clip keys could collide when names contain /. Keys are now a JSON tuple.
  • Sounds firing together, or in dense runs, covered each other. Clips closer than 10px are now packed into rows, with no row cap.
  • Clips covered each other at the left edge when panned. Packing now uses each clip's on-screen position.
  • Settings were dropped for clips with very long names. The key length limit is raised.

The last round found no bugs.

Testing

screw-bugs walkthroughs, all passing:

  • 9 cases on the test fixture.
  • 9 cases on a real 35 s scene with 38 sound effects (a bare .riv): add tracks, a voice-over on its own track, stepped levels with apply-to-all, rename, solo and mute, collapse, persistence across a reload, removing a track.
  • A follow-up run on the same scene: dense and simultaneous clips are each clickable, and levels persist.

Not covered: dragging (the runner has no drag action; moving between tracks was tested with ↑/↓) and listening to the actual levels (the browser was headless).

🤖 Generated with Claude Code

    1. fuko merged this80b5dad

    2. fuko closed this

Sign in to join this conversation.