vchelaru/flatredball2/audio
Claude Code and agent skill by vchelaru/flatredball2
- community
Checking that the SKILL.md file is still in the repository.
Audio in FlatRedBall2. Use when working with sound effects, background music, AudioManager, loading Song or SoundEffect, volume control, or collision sound triggers.
Install
npx vskill@latest install vchelaru/flatredball2/audioSKILL.md
Audio in FlatRedBall2
Access
Loading Audio
Two paths. In the Common/Desktop template layout, prefer the direct path — it matches how every other raw asset (png, tmx, achx) is handled, with audio files living alongside them in Common/Content/. Reach for MGCB only when a format limit forces it (MP3).
Direct path — load the raw file (default for OGG/WAV)
Drop the file in Common/Content/ (e.g. Common/Content/Audio/song.ogg); it is linked into the Desktop output's Content/ automatically, no .mgcb entry needed. Load by full path with extension.
Song (music) — OGG only. Song.FromUri accepts only OGG Vorbis on DesktopGL; MP3 fails at runtime (NVorbis backend).
SoundEffect — WAV only. SoundEffect.FromStream accepts only PCM WAV. OGG/MP3 effects need the MGCB path below.
Usings: System.IO, Microsoft.Xna.Framework.Audio, Microsoft.Xna.Framework.Media.
MGCB pipeline — for MP3 or compressed formats
Needed only when the direct path's format limits bite. The .mgcb lives in the `.Desktop` head, not Common: only a head that references nkast.Xna.Framework.Content.Pipeline.Builder and declares <KniContentReference Include="Content/Content.mgcb" /> builds XNBs, so a mgcb added to Common is silently never built. Put the #begin entry and the source file under Desktop/Content/. See multiplatform-conversion for the content-split rationale.
Load with the asset name minus the source extension — /build:Audio/song.mp3 builds to Audio/song.xnb:
Usings: Microsoft.Xna.Framework.Audio, Microsoft.Xna.Framework.Media.
Sound Effects
Per-frame dedup: calling Play(sfx) multiple times in a single frame (e.g., from CollisionOccurred firing on multiple pairs) plays the sound only once; pass playAlways: true to stack instances. Cross-frame overlap is allowed.
Background Music
Playlist
Pitchable music (runtime pitch/speed control)
PlaySong/PlayPlaylist are backed by MediaPlayer, which exposes no pitch/rate control on any backend. For a slow-mo effect or similar, use PlayPitchableSong instead — it streams a raw OGG file through a DynamicSoundEffectInstance, which does support real-time pitch:
PauseSong/ResumeSong/StopSong/MusicVolume/MusicEnabled all work the same regardless of whether PlaySong or PlayPitchableSong is active.
Volume and Enable/Disable
Gotchas
- Music does not stop automatically on screen transition — call
Engine.Audio.StopSong()inCustomDestroy, or music keeps playing into the next screen. - `Song.FromUri` only works with OGG — on DesktopGL (NVorbis),
Song.FromUrifails at runtime with MP3. Use the MGCB pipeline andEngine.Content.Load<Song>for MP3 files. - `Load<>` name drops the source extension —
Load<Song>("Audio/song"), not"Audio/song.ogg". Passing the extension makes the content manager look forsong.ogg.xnb(the pipeline buildssong.xnb) and throwsFileNotFoundException. The.mgcbdefining it must be in the.Desktophead, notCommon. - Track SoundEffect only when loaded via `FromStream` — call
Engine.Content.Track(sfx)when usingSoundEffect.FromStreamso it is disposed on screen transition. MGCB-loaded assets (Engine.Content.Load<SoundEffect>) are disposed automatically by the ContentLoader — do not callTrackfor those. - Per-frame dedup in collision handlers —
Play(sfx)in aCollisionOccurredhandler is safe to call unconditionally; it fires at most once per frame regardless of how many pairs collide (unlessplayAlways: true). - Looping sounds are not stopped on screen change — keep the
SoundHandleand callStop()inCustomDestroy. - `PlayPitchableSong` is OGG-only, same as
Song.FromUri. It loads the raw file directly (not viaSong), soEngine.Content.Load<Song>/MGCB assets don't apply here. - `MusicPitch` is a silent no-op while a `PlaySong`/`PlayPlaylist` track is active —
Song/MediaPlayerexpose no pitch API on any backend. Switch toPlayPitchableSongto get real pitch control.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingfrb-skills/audio/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/vchelaru/flatredball2/audio)