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

Yesterday, I made the first release of 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.
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.


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.


sub kuch said…
This is not the first of your posts I've read, and you never cease to amaze me. Thank you, and I look forward to reading more.

Sub Kuch
sub kuch said…
You have some interesting thoughts! Perhaps we should contemplate about attempting this myself.

Sub Kuch

Popular posts from this blog

Is PostgreSQL good enough?

Experiments with new low latency PyPy garbage collector in a thread.

🐱‍🏍 — the first pygame 2 community game. Starting now! Are you in?