s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationMediaAudio
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Media
Media

Audio

MusicPlayer

MusicPlayer is for music tracks and streaming audio that need programmatic control over playback, positioning, or visualization. For in-game sound effects and Sound components, see Sound.

var music = MusicPlayer.Play( FileSystem.Mounted, "music/theme.ogg" );
music.Volume = 0.8f;
music.Repeat = true;

Streaming from a URL:

var music = MusicPlayer.PlayUrl( "https://example.com/stream.ogg" );

By default, MusicPlayer plays globally. To place it in world-space:

music.ListenLocal = false;
music.Position = WorldPosition;

Audio visualization:

ReadOnlySpan<float> spectrum = music.Spectrum;   // 512-element FFT magnitudes
float amplitude = music.Amplitude;               // approximate loudness

Supported Formats

CodecContainers
Opus.ogg, .opus, .webm
Vorbis.ogg, .webm
FLAC.flac
MP3.mp3
WAV / PCM.wav
AACMP4 (Windows only via Media Foundation, not recommended)

:::warning AAC is only available on Windows via system decoders and is not recommended. Use Opus instead. :::

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2026-04-22. Read it rendered on the official docs.

More in Media

Media
Video
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.