SoundManager 2

A Javascript Sound API supporting MP3, MPEG4 Audio and Video.

What SoundManager 2 does

Audio features, accessible from javascript.

About SoundManager 2, Features and Live Demos

Live SoundManager 2 demos, shiny!

Playable MP3 links

Muxtape-style UI

MPEG-4 Video

 
speaker icon

Javascript Sound For The Web

SoundManager 2 makes it easier to play sounds using Javascript.

By wrapping and extending Flash 8's sound API, SoundManager 2 brings solid audio functionality to Javascript. How it works »

Features At A Glance

  • Load, stop, play, pause, mute, setPosition/seek, pan and volume control of sounds from Javascript
  • Events: onload, whileloading, whileplaying, onfinish and more
  • ID3V1 and ID3V2 tag support for MP3s (title, artist, genre etc.)
  • Optional API features with Flash 9+:
    • MPEG-4 (HE-AAC/H.264) audio and video support
    • Sound multiShot (chorusing effect, play a sound many times at once)
    • Sound waveform/frequency spectrum data (MP3)
    • Sound peak (L/R channel volume) data (MP3)

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:

soundManager.play('mySound','/path/to/an.mp3');

And, setting the volume:

soundManager.setVolume('mySound',50);

More flexible method supporting option parameters as an object literal:

var mySound = soundManager.createSound({
  id: 'someSound',
  url: '/path/to/some.mp3',
  volume: 50,
  onload: soundLoaded
});
mySound.play();

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 onload() handler.

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

See a basic template demo

Licensing

BSD licensed.

SoundManager 2 is provided under a BSD license.

%s1 / %s2