Code-first video & image, rendered natively on WebGPU.
Framefields Audio Capabilities Example (24_audio_capabilities)
Demonstrates code-first WebGPU audio DSP, multi-track mixing, and procedural sound design in Framefields:
- Step 1: Baseline / Initial Audio — Unprocessed score soundtrack loaded with explicit timing (
durationFrames,volume). - Step 2: Faded Audio — WebGPU compute
AudioFadeDSP shader performing smooth envelope gain modulation (2.0s linear fade-in and 2.0s s-curve fade-out). - Step 3: Faded + Reverb Audio — Multi-stage WebGPU audio DSP pipeline chaining
AudioFadedirectly intoAudioReverb(room size 0.85, wet mix 0.6, stereo damping 0.2). - Step 4: Ping-Pong Delay — WebGPU compute
AudioDelaycreating spatial bouncing stereo reflections (0.28s delay time, 45% feedback, 55% wet mix). - Step 5: Parametric EQ Filter — WebGPU compute
AudioParametricEqbiquad low-pass filter (750 Hz cutoff, Q factor 1.2). - Step 6: Dynamics Compressor — WebGPU compute
AudioCompressorpunchy dynamics control (-22 dB threshold, 6:1 ratio, 8 dB soft knee, +4 dB makeup gain). - Step 7: Stereo Panning — WebGPU compute
StereoPanningwith dynamicSignalmodulation smoothly sweeping the soundstage from full left to full right across the clip (pan: -1.0 → +1.0).
Each stage is exported both as uncompressed 16-bit PCM WAV audio and as high-quality MP4 video with synchronized audio.
Quick Start
# Render all 7 audio steps (.wav) and encoded videos (.mp4)
pnpm --filter @framefields/example-24-audio-capabilities render
# Render only WAV audio files
pnpm --filter @framefields/example-24-audio-capabilities render wav
# Run automated tests
pnpm --filter @framefields/example-24-audio-capabilities test
# Typecheck
pnpm --filter @framefields/example-24-audio-capabilities typecheck
Output Files
When running pnpm render, files are written to examples/24_audio_capabilities/output/:
output/step1_initial_audio.wav&output/step1_initial.mp4output/step2_faded_audio.wav&output/step2_faded.mp4output/step3_faded_reverb_audio.wav&output/step3_faded_reverb.mp4output/step4_delay_audio.wav&output/step4_delay.mp4output/step5_parametric_eq_audio.wav&output/step5_parametric_eq.mp4output/step6_compressor_audio.wav&output/step6_compressor.mp4output/step7_stereo_pan_audio.wav&output/step7_stereo_pan.mp4
Code Example
import { Composition, Layer, Effect } from "framefields";
const comp = new Composition({ width: 1280, height: 720, fps: 30, durationMs: 6000 });
// Add audio soundtrack with chained WebGPU DSP effects
comp.addAudio(
Layer.audio("assets/score.mp3", { durationFrames: 180, volume: 1.0 })
.apply(Effect.audioFade({ fadeInDuration: 2.0, fadeOutDuration: 2.0 }))
.apply(Effect.audioReverb({ roomSize: 0.85, damping: 0.2, wet: 0.6, dry: 0.7 }))
.apply(Effect.audioDelay({ delayTime: 0.28, feedback: 0.45, pingPong: true }))
);
// Render video with audio
await comp.renderVideo("output/video.mp4");