jsSID by Hermit - a javascript SID emulator and player for the Web Audio API

(It doesn't need Flash-player or Java-VM, it's pure JavaScript.)

Web Audio API is supported (and contained) by browsers (according to Wikipedia) since these versions:

The player supports simple Vsync/CIA timed SIDs. SIDs with custom player and digis are not fully implemented.

To include jsSID at your page, 'jsSID.js' should be included in body/header of your HTML code:

<script type="text/javascript" src="jsSID.js"></script>

Examples

Let's see some examples (HTML buttons that handle various aspects of jsSID):

Simple way

If you just want to simply play a SID without manually creating and initializing a JS object:
(This creates a jsSID object called 'SIDplayer' automatically behind the scene, so you can use its functions.)


playSID('URL', subtune);

A bit more expert way

If you want to create a SIDplayer object manually before using its functions:

SIDplayer = new jsSID(buffersize, background_noise); //background noise around 0.0005 is suitable
Samplerate is inherited from the web-browser, usually 44100Hz.
Buffersize values that make sense: 1024/2048/4096/8192/16384, maximal 16384 advised at 44100Hz and above.

Then (as jsSID object called 'SIDplayer' is created) you can use its subfunctions/methods:

Choose file:

or type local URL:

SIDplayer.loadstart('URL', subtune);

Controls

SIDplayer.loadinit('URL', subtune);
subtune:1

In JavaScript:

SIDplayer.start(subtune);
SIDplayer.playcont();
SIDplayer.pause();
SIDplayer.stop();

volume:

100%

In JavaScript:

SIDplayer.setvolume(volume);
SIDplayer.getoutput(); //volume range: 0..1

Song info

Playtime:

SID Title: ...

SID Author: ...

SID release info: ...

No. of subtunes: 0

Preferred SID-model for tune: 0, using:

SIDplayer.gettitle();
SIDplayer.getauthor();
SIDplayer.getinfo();
SIDplayer.getsubtunes();
SIDplayer.getprefmodel();
SIDplayer.getplaytime();
//'playtime' is in seconds
SID-model for playback: SIDplayer.getmodel();
SIDplayer.setmodel(model);
//models: 8580.0 or 6581.0
Set callback functions (e.g. displaying SID-file info) for jsSID events:
SIDplayer.setloadcallback(function_name);
SIDplayer.setstartcallback(fn);
SIDplayer.setendcallback(fn,playtime); //in seconds

A simple playlist player can be found in this folder: playlist.html

You can also hear jsSID in action at: http://hermit.sidrip.com