shitsound /

Filename Size Date modified Message
scripts
sounds
swf
2.6 KB
10.0 KB
2.8 KB
228 B
2.0 KB

shitsound

jquery.shitsound.js is a shit sound player for web browsers.

Used like this:

$.snd.init({}, function () {
        // we are ready to play sounds!  Brilliant.
        $.snd.play('hello');
});
shitsound only does a few things with sound::
play, stop, stopAll
jquery.awesound.js might do:
changing volume, pitch, playing with a different tempo, playing in stereo, 3d sound, etc.

jquery.shitsound can not do any of this fancy stuff. It can just play sounds, and stop playing them.

shitsound detects which implementation to use at init time.

  • html5, using the html5 audio tag.
  • embed, for using the embed tag.
  • soundmanager1, for old flash 7.
  • soundmanager2, for modern flash (8,9,10+).
  • empty, pretend implementation that does nothing.

It currently requires jquery, since I use jquery. However it could quite easily drop the jquery dependency with some work. Other dependencies are soundmanager 1 and soundmanager 2, as well as (optionally) swfobject. These are all bundled in ready to use though.

Each implementation is kept separate in the code base, and it is fairly easy to extend with other implementation. The html5 implementation is separate from the soundmanager1 implementation for example. I plan on implementing a phonegap implementation in the future.

If you'd like to see another JavaScript audio engine supported, please let me know.

Yes, it does support netscape navigator 3+. As well as old versions of internet explorer that don't have flash installed, or have old versions of flash installed.

preparing your audio

Because sound support on the web is shit, you need to prepare your audio in various different formats for it to work cross platform.

You need a .wav file, a .mp3 file, and an .ogg file to support all platforms.

It might not be a good idea to include big .wav files for large amounts of audio like songs though. Because they can be 10 times larger than a lossily compressed mp3 or ogg file. But if you want full browser support, then .wav files are required.

The ffmpeg is quite a common powerhouse of a multimedia tool. It is available on OSX through brew, or macports. It can even convert audio for you.

  • ffmpeg -i file.wav file.mp3
  • ffmpeg -i file.wav file.ogg

preparing your webserver

If you use nginx you might need to modify your /etc/nginx/mime.types file for oggs::
audio/ogg ogg;

Other web servers may also need mime types being added.

future

Maybe these things will be done in the future.

  • volume control. This is possible with all backends.
  • Better browser detection, and blacklisting of bad html5 audio engines.
  • wider testing and debugging.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.