A JavaScript Sound API supporting MP3, MPEG4 and HTML5 Audio.

What SoundManager 2 does

Audio features, accessible from JavaScript.

About SoundManager 2, Features and Live Demos

SoundManager 2 makes it easier to play audio using JavaScript.

Using HTML5 and Flash, SoundManager 2 provides reliable cross-platform audio under a single JavaScript API. How it works »

More sound, in more places

SoundManager 2 speaker logo

Despite being one of the senses, sound has largely been missing from the web due to inconsistent technology support. SoundManager 2 bridges this gap, making it easier to use audio across a growing variety of devices and platforms.

Complexity, reduced

Supporting HTML5 audio in modern browsers can be tedious, let alone "legacy" HTML4-based ones. With technology ranging from mobile Safari down to IE 6, there's a lot of ground to cover.

SoundManager 2 gives you a simple but powerful API that supports both new and old, using HTML5 audio where supported and an invisible Flash fallback where needed. Ideally when using SoundManager 2, audio "just works."

Less talk, more shiny

wheelsofsteel.net: Online turntable demo (screenshot)

Experimental demo: The Wheels Of Steel, a browser-based DJ turntable prototype. For the tech details, read An Ode To Turntables (in HTML.)

Inline demos using SoundManager 2

Big features, small footprint

SoundManager 2 packs a full-featured API (100 KB of code) into as little as 10 KB over the wire. The source is provided in fully-commented, -no-debug and compiler-optimized "minified" versions appropriate for development and production use.

Technical details

HTML5 Audio Support (Beta-ish)

  • 100% Flash-free MP3 + MP4/AAC where supported. Works on iPad, iPhone (iOS4)
  • Seamless flash fallback for MP3/MP4 content, if needed
  • HTML5/Flash API switching is transparent, handled internally
  • WAV + OGG playback possible via HTML5, if supported
  • See useHTML5Audio for implementation details
  • Want more on the state of HTML5 audio? Read the article (12/2010), or watch the video talk + turntable demo (05/2011)

Basic API Features (HTML5, Flash 8*)

  • Load, stop, play, pause, mute, seek, pan*, volume control from JavaScript
  • Events: onload(), whileloading(), whileplaying(), onfinish() and more
  • ID3V1 and ID3V2 tag support for MP3s (title, artist, genre etc.)*

Shiny Flash 9-only Features

  • RTMP / Flash Media Server streaming support (experimental) - see serverURL
  • MPEG-4 (AAC, HE-AAC, H.264) audio support
  • "MultiShot" play (layered/chorusing effects)
  • Waveform/frequency spectrum data
  • Peak (L/R channel volume) data
  • Audio buffering state/event handling

General Tech Stuff

As Heard On TV The Internets

A few nifty places SoundManager 2 has been seen in use on the Wild World Web:


Get SoundManager 2


Playing MP3s with JavaScript

Play audio in one line, or get fancy with multiple options.

How To Play Audio Using SoundManager 2

Simple ID / URL method:


And, setting the volume:


More flexible method supporting option parameters as an object literal:

var mySound = soundManager.createSound({
  id: 'someSound',
  url: '/path/to/some.mp3',
  volume: 50,
  onload: soundLoadedFunction

See API Demos

Using SM2 on your site

How to include SoundManager 2 from HTML, and some basic event handlers.

Include the SoundManager 2 core script, tell it where to look for the flash .SWF and provide an onready() callback.

<script src="/path/to/soundmanager2.js"></script>
soundManager.url = '/path/to/swfs/';
soundManager.onready(function() {
  // SM2 is ready to go! 
  // soundManager.createSound(...) calls can now be made, etc.

See a basic template demo


BSD licensed.

SoundManager 2 is provided under a BSD license.