1.0.11 • Public • Published


IntSound is an abstraction layer on soundjs. It's used to easily transform jQuery selections into sound buttons.


Old-fashioned script embed

<script type="text/javascript" src="/your/path/int-sound/lib/soundjs.min.js"></script>
<script type="text/javascript" src="/your/path/int-sound/intSound.js"></script>
<!--[if lte IE8]><script type="text/javascript" src="/your/path/int-sound/lib/flashaudioplugin-0.6.1.min.js"></script><![endif]-->

<!-- intSound is now available at window.intSound -->
<script type="text/javascript">
  IntSound.tie($('.my_btn'), 'sounds', 'mysound');


var intSound = require('./intSound');
intSound.tie($('.my_btn'), 'sounds', 'mysound');


.tie($btn, sound_dir, sound_id, conf)

When $btn is clicked, a specified sound will load and play. During loading, $btn will gain the class loading_sound. When playing a sound, $btn will gain the class playing_sound.

  • $btn: A jQuery selection.
  • sound_dir: String. The directory in which the sound file is stored, e.g. "sound"
  • sound_id: String. The name of the sound file without the extension.
  • opts: A dictionary of configuration options.
    • behavior: String. If set to "key," the button will behave like a piano key, i.e. it will not stop any other sounds that are currently playing. The default behavior is for the button to stop all other sounds.
    • onStartLoad: Function. Fires after the sound starts loading. Useful for changing the state of the button during load. This fires after a short delay and does not fire if the sound loads before that delay ends. The default delay is 300 milliseconds and can be changed with loadDelay.
    • onEndLoad: Function. Fires when the sound stops loading.
    • loadDelay: Integer. The number of milliseconds to wait after loading has initiated before firing the onStartLoad function, if specified.


Stops all sounds from playing, and removes the class playing_sound from all elements.


Removes a listener added by tie() from the specified button.


(This has not yet been tested!)

Compatibility with IE8 requires additional JS. This is loaded asynchronously during runtime via RequireJS if RequireJS is on the page.

For a solution that does not use RequireJS, directly embed lib/soundjs-0.6.1.min.js on the page using IE conditional tags.




DownloadsWeekly Downloads






Last publish


  • chrkirk