sound-design
Add sound effects to a clip using Freesound API search and AI sound design placement.
SKILL.mdAutoAnimation/.claude/skills/sound-design/SKILL.md
GitHubPurpose
Add sound effects to a clip using two sources: searching Freesound.org's 500K+ Creative Commons library, or generating sound effects via ElevenLabs. Includes an intelligent auto-SFX system that detects scene events (text reveals, transitions, shape entrances) and places appropriate sound effects automatically.
Steps
Choose a source: search or generate.
- Search (Freesound): Use
getFreesoundService().search({ query, pageSize, filter })to find sounds. Results includepreviews['preview-hq-mp3']for playback andid,name,tags,duration,licensemetadata. Filter by duration withfilter: "duration:[0 TO 5]". - Generate (ElevenLabs): Use
generateSoundEffect({ text, durationSeconds, promptInfluence })fromelevenlabs.tsto AI-generate a sound effect from a text description.
- Search (Freesound): Use
Preview sounds. The
useSoundEffectStoremanages preview state. Callstore.preview(hit)to play a Freesound result (usespreview-hq-mp3URL). Callstore.stopPreview()to stop. The store trackspreviewingIdandpreviewUrl.Download and import. For Freesound results, use
getFreesoundService().downloadAsBlob(previewUrl)to get a Blob. Falls back to a server proxy (/api/proxy/audio) if CORS blocks direct download. For generated SFX, the result already includesaudioBlobandaudioUrl.Place on timeline. Add the sound to the appropriate timeline position. The orchestrator uses
ClipPlanSoundEffectobjects withprompt,source('search' or 'generate'),startPercent,durationSeconds, andvolume.Auto-SFX with presets. Use
applySoundDesignPreset(plan, presetId, fps)fromsoundDesigner.tsto auto-enrich a clip plan. Available presets:corporate-- clean, professional (click transitions, text-reveal SFX)energetic-- punchy, high-energy (whoosh transitions, accent hits)dramatic-- cinematic, intense (cinematic transitions, ambient bed)chill-- mellow, no transitionshorror-- dark, eerie (glitch transitions, ambient wind)comedy-- playful (click transitions, notification sounds)educational-- clean, minimal (subtle transitions, notifications)cinematic-- film-quality (cinematic transitions, room tone ambient)retro-- synthwave (glitch transitions, accent hits)minimal-- barely-there audio
Detect scene events.
detectSceneEvents(plan, fps)analyzes a clip plan for events that should trigger SFX: text-enter, text-exit, media-transition, scene-change, dialogue-start, dialogue-end, shape-enter. Events are sorted by frame.Generate auto SFX.
generateAutoSfx(events, preset, existingSfx)maps events to SFX prompts based on the preset'sautoSfxTypes.generateTransitionAudio(events, preset)creates transition sounds (whoosh, click, glitch, etc.) limited to max 8 per clip.
Key Files
src/services/soundDesigner.ts-- SoundDesignPreset, SOUND_DESIGN_PRESETS, detectSceneEvents(), generateAutoSfx(), generateTransitionAudio(), applySoundDesignPreset(), enhanceMusicPrompt(), validateAudioMix()src/services/freesound.ts-- FreesoundService class, search(), downloadAsBlob(), FreesoundHit typesrc/services/elevenlabs.ts-- generateSoundEffect(), GenerateSoundEffectResultsrc/stores/useSoundEffectStore.ts-- SFX search state, preview playback, generate prompt statesrc/components/panels/SoundEffectsPanel.tsx-- Sound effects browser UI
Common Issues
- Freesound API key: Must be set as
VITE_FREESOUND_API_KEY. UsehasFreesoundService()to check availability. - CORS on Freesound previews: Direct fetch may fail. The service auto-falls back to
/api/proxy/audioserver proxy. - Rate limiting: Freesound returns HTTP 429 when rate-limited. The service throws a user-friendly error.
- SFX overlap with dialogue:
validateAudioMix()insoundDesigner.tschecks for SFX-dialogue timing conflicts and suggests shifting SFX to natural pauses. - Auto-SFX deduplication:
generateAutoSfx()tracks used frame positions to avoid placing multiple SFX at the same timestamp.
Examples
// Search Freesound
const service = getFreesoundService()
const results = await service.search({
query: 'whoosh transition',
pageSize: 10,
filter: 'duration:[0 TO 3]',
})
// Generate SFX with ElevenLabs
const sfx = await generateSoundEffect({
text: 'dramatic impact hit with reverb',
durationSeconds: 2,
promptInfluence: 0.5,
})
// Apply sound design preset to a clip plan
const enrichedPlan = applySoundDesignPreset(clipPlan, 'cinematic', 30)