Version 1.0.20041003a
January 2007: SM1 end of life notice
SoundManager ("V1") is no longer supported nor maintained. It has been deprecated in favour of SoundManager 2, which provides a highly-featured Javascript sound API via Flash 8 + ExternalInterface, better documentation and demos. Check it out.
SoundManager is an object-oriented library/API which provides a Javascript interface to control sounds loaded in a hidden Flash movie.
A small Flash "stub" movie loads audio files with IDs as assigned by an external XML file. These sounds can then be controlled by the SoundManager Javascript API using predefined methods.
A sound is loaded into the Flash stub movie via XML such as:
<sound id="mySound" href="soundfile.mp3" />
This sound can then be played via the following Javascript: soundManager.play('mySound');
Refer to the test controls at right, or hit this simplified example page for a basic demo.
Soundmanager v1.0.20041003a (108 KB, .ZIP)
Free for use. Questions, comments, complaints etc. can be sent via e-mail (see Credits)
The following methods are defined under SoundManager:
soundID,loopCount
)soundID
, loopCount
times.soundID
: ID of the sound to be played, as defined in the XML configuration file.loopCount
: Number of times (default=1) to play the sound.soundManager.play('mySound');
soundID
)soundID
.soundID
: ID of sound as defined in XMLsoundManager.stop('mySound');
soundID,pan
)soundID
.soundID
: ID of sound as defined in XMLpan
: Integer from -100 to 100soundManager.setPan('mySound',-25);
soundID,volume
)soundID
.soundID
: ID of sound as defined in XMLvolume
: Integer from 0 to 100soundManager.setVolume('mySound',75);
A script include is required for the SoundManager API. A single Flash movie (.swf) provides the stub for loading sounds, and an XML file defines the sounds to be loaded and their corresponding IDs referenced within the API calls.
soundmanager.js
: API librarysoundcontroller.swf
: Flash "stub" loadersound-config.xml
: Flash sound/script ID definitionsThis functionality requires a browser with Javascript and Flash 6 support, and support for Javascript-to-Flash plug-in communication (see Macromedia's "Scripting with Flash" page for exact version and platform details.)
Testing has been done on the following:
According to Macromedia, looping of imported MP3 audio is not seamless. (D'oh.)
It appears that Javascript-to-Flash communication is not supported under ie:Mac due to the way the plug-in is compiled for the OS, so this type of scripted sound is not possible on this platform. Interestingly enough, it has been reported to work under Mozilla Firefox on Linux.
A mysterious beast at best, likely on the "unsupported" list in terms of JS-to-Flash communication.
Sound Object Reference - Actionscript.org
Macromedia TechNotes: "Why do my looping sounds pause between loops?
Sound Effects Tutorial (Dynamic MP3 loading via XML) - Sitepoint.com
The inspiration source for my initial experiments with JS-to-Flash communication back in 2001. Now a bit dated (and not compatible with Mozilla,) but still a good reference.
Code by Scott Schiller.
Schillmania.com: Personal experimental DHTML site
Scottschiller.com: Professional and technical experience portfolio