audio — Claude Code rule: sound in Remotion
Rule for handling sound in Remotion: import audio files, trim, adjust volume and playback speed, shift pitch. Requires the @remotion/media package.
no license ★ 849 updated 2026-01-24
.claude/rules/audio.mdWhat audio does
This rule explains how to add and edit audio tracks in Remotion video compositions. It covers importing local and remote audio files via the <Audio> component, trimming by frame count (trimBefore, trimAfter), delaying playback with <Sequence>, static and dynamic volume control through callbacks, muting, playback speed adjustment (playbackRate), looping (loop) with frame count behavior options, and pitch shifting (toneFrequency ranging 0.01 to 2).
Install the @remotion/media package first using npx remotion add @remotion/media (or the equivalent for bun, yarn, pnpm). Pitch shifting only renders on the server; the effect will not appear in Studio preview or the <Player> component. Reverse playback is not available.
What it helps with
- embed an audio file into a Remotion video composition
- trim audio start and end points by frame count
- set static or animated volume with transitions
- create looping audio with controllable frame counting behavior
- adjust pitch independently of playback speed
Example prompts for the agent
- Add audio from
background.mp3throughout the entire composition - Trim the first 2 seconds and end at the 10-second mark while fading volume from 0 to 1
- Loop background music and raise its pitch to 1.5 during server-side rendering
How to install audio
Manually: put the files in place
.claude/rules/audio.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/audio.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/audio.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/audio.mdManually: put the files in place
.clinerules/audio.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about audio
How do I install the audio rule in Claude Code?
Copy the audio.md file into your project's .claude/rules/ directory. Claude Code will then apply the rule automatically when you work with audio in Remotion.
What does the audio rule cover?
It provides code examples and guidance on importing audio, trimming clips, controlling volume, adjusting playback speed, and applying effects like pitch shifting and looping to audio tracks in Remotion.
Why doesn't pitch shifting work in the preview?
The toneFrequency property only takes effect during server-side video export, not in Studio preview or the <Player> component. Test your pitch changes by rendering the video to file.