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.

Library GZip Uncompressed Comment
bassoonplayer-min.js 16.6 kB 48.5 kB Minified
bassoonplayer.js 24.4 kB 125.68 kB Not minified - useful for debugging

The most simple example would be: <script src="bassoonplayer-min.js" type="module"></script> <script> BassoonTracker.load("url/to/file.mod").then(function(){; BassoonTracker.play(); }); </script> Please note that most modern browser disable audio playback until a user action, so you may need a "play" button to initiate playback.

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 the volume, you can use BassoonTracker.audio.masterVolume which is a WebAudio GainNode.

Some more examples: