Hi, Today I am talking about a Javascript sound API (soundManager 2) which supports MP3, MPEG4, and HTML5 Audio. It helps us to play any audio in the easiest way.

it’s 100% Flash free MP3 + MP4/AAC (and OOG, FLAC etc) supported.

Compatible with Apple iPad (iOS 3.2), iPhone/iOS 4 and newer.

Basic API Features

  • Load, stop, play, pause, mute, seek, pan (Flash-only) and volume control of sounds from JavaScript
  • Events: onloadwhileloadingwhileplayingonfinish and more.


Just add the soundManager2.js file in your HTML code.

<script src=”soundmanager2.js”></script>

Sounds can be created with instance-specific parameters in an object literal (JSON-style) format, where omitted parameters inherit default values as defined in soundManager.

This object can also be passed as an optional argument to the play method, overriding options set at creation time.

Object Method:-

SoundManager provides wrappers for most SMSound methods – eg. soundManager.play('mySound') checks for a valid sound object, and then calls soundManager.sounds['mySound'].play() on that particular object; thus, it is the same as var sound = soundManager.getSoundById('mySound'); mySound.play();

The following methods can be called directly on a SMSound instance. The method calls are the same as the SoundManager global methods documented above for existing sound objects, minus the sound ID parameter.

SoundManager: Default Sound Options:-

Sound objects inherit properties from soundManager.defaultOptions when they are created.

Sound parameters can be overridden on a per-sound basis at create time, or changed dynamically in some cases. Note that none of these options are required when calling createSound() except for id and url; the others will inherit the default values if unspecified.

soundManager.defaultOptions apply the properties and event handlers as specified above. Defaults are shown below as an example.

Some places that do or have used SM2 include SoundCloud, Tidal, Beats, Songza, freesound.org, last.fm, 8tracks, Discogs, and The Hype Machine among others.

I hope you like this blog and you can play audio in an easy way.

Please comments and share your experience with us to make us better next time.