Loading song...
Play
Example of the standalone BassoonTracker playback routine, playing a module file without the tracker interface.
Hit the "play" button above to start the playback.

Just include a single JS file and you're good to go.
Size comparisons (v0.4.0) of provided libraries

Library GZip Uncompressed Comment
bassoonplayer.js 44.9 kB 187 kB Untouched - useful for debugging
bassoonplayer-min.js 22.6 kB 68.6 kB Untouched
b-min.js 20.4 kB 55.5 kB Squeezed
b-pack.js 19.8 kB 41.5 kB RegPacked
b-zip.js 23.4 kB 29.2 kB zipped - supports zipped mods

The most simple example would be: <script src="bassoonplayer-min.js"></script> <script> BassoonTracker.init(true); BassoonTracker.load("url/to/file.mod",true); </script> The second parameter in BassoonTracker.load defines autoplay.
Please note that most modern browser disable audio playback until a user action, so you may need a "play" button to initiate playback.
You can use a third parameter as callback function when the loading of the file is done.
<script> BassoonTracker.load("url/to/file.mod",false,function(){ //... do something }); </script> After BassoonTracker.init you might want to check "Audio.context" to see if the browser supports WebAudio.

Some useful methods: The playback itself is scheduled in WebAudio and completely detached from the main JS thread.
Therefore there are no direct events to indicated playback progress.
If you want to display some UI with a progress indicator you will have to keep track of the start time of the song (Audio.context.currentTime) and call BassoonTracker.getStateAtTime(time) periodically
(or BassoonTracker.getTimeStates() to get the complete list).
Note that the Tracker schedules audio ahead, so the last item in the BassoonTracker.getTimeStates() list will be in the future.
Refer to this example with progress tracking for a demo.

If you want to adjust to volume, you can use BassoonTracker.audio.masterVolume which is a WebAudio GainNode.