DreamFabric.comDiscussion ForumsJaC64Game-of-the-MonthJaC64 InfoJSIDPlayJSIDPlay InfoJava Stuff (to be updated)

JSIDPlay - Java SID Player
This page contains some information and usage instructions about JSIDPlay. A SID Player completely written in Java (requires Java 1.4). Some features like the combined waveforms and digital emulation of the filters have been adapted from re-sid the best SID emulator. For more SID in Java implementation specific details see Implementation details



JSIDPlay - Features and Docs
JSIDPlay is Based on JaC64 - Java C64 Emulator. JSIDPlay is available on-line with the HVSC SID collection available from here. Go and have a listen to some of the classic SIDs (if you have not already done it)!

Features

  • ADSR emulation including ADSR bug
  • Emulation of combined waveforms using same method as re-sid (sample-lookup)
  • Filter (LP/BP/HP) with resonance
  • Synchronization, ring modulation, etc.
  • Interrupts from both vertial beam and timers which enable different play-speeds (e.g. not only 50Hz tunes)
  • Bank switching
  • PSID sample play (Galway Noise, and ordinary samples)
  • Supports .sid files (PSID, some RSIDs)
  • Animation/Oscilloscope shows all SID voices, ADSR, frequency, etc while playing.
  • Delay and Filter Effect units to get echos, flangers, chorus, filter sweeps, etc added to the SID music.

How to use it!

If you just want to use it here at my site there is not too much to say about it, just click some of the songs from Hubbard and Galway and listen, or enter a HVSC song path and listen to it instead. Note that there might be some bugs in the player so not every song is working.

If you instead want to use it on your own web-site as a music player you need to know a bit more. First, you will need some HTML-code to embed the Java applet into your web page, this is some basic code that should work in most browsers (note that the codebase is up one directory in this case - if in the same, it is not necessary to specify codebase is used for finding the roms, etc which are shared with JaC64).

<object  classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93'
   codebase='http://java.sun.com/products/plugin/autodl/jinstall-1_4_1-windows-i586.cab#Version=1,4,1,0'
   width='285' height='420' id='jsidplay'>
  <param name=code value='com.dreamfabric.jsidplay.JSIDPlay'>
  <param name=archive value='jsidplay/jsidplay.jar'>
  <param name=codebase value='../'>
  <param name=type value='application/x-java-applet;version=1.4.1'>
  <param name='scriptable' value='true'>
  <param name='playsid' value='sids/Delta.sid'>
  <COMMENT>
    <embed   type='application/x-java-applet;version=1.4.1'
       name='jsidplay'
       code='com.dreamfabric.jsidplay.JSIDPlay'
       codebase='../'
       archive='jsidplay/jsidplay.jar'
       playsid='sids/Delta.sid';
       width='285'
       height='420'
       scriptable='true'
       pluginspage='http://java.sun.com/products/plugin/index.html#download'
       alt='Your browser is not running the Java Applet, for some reason.'>
       <noembed>Your browser is ignoring the Java Applet! </noembed>
    </embed>
  </COMMENT>
</object>
There are a few important parameters that can be used to get different versions of the applet and to control which sid and song to be played. These are:
  • playsid - which specifies the sid to play when JSIDPlay is loaded/started
  • playsong - specifies the song number to play (if another than the default song should be played)
  • viewmode - specifies what to show. Nothing gives the Normal mode and "status" shows the oscillators, filters, etc: Status Mode, and finally setting the value to "controls" will give Controller Mode. Setting the value to anything else ("none" for example gives a Label-only mode.
When the applet is running there are a number of Javascript calls that can be used to control the applet. Some are (see them in action on the JSIDPlay page):
  • playSIDFromURL(String url) - to play a SID from a URL, usage example:
    <a href="javascript:document.jsidplay.playSIDFromURL('jsidplay/sids/Hubbard_Rob/Zoids.sid')"> Zoids</a>
  • nextSong() - to play the next song of the SID, usage example:
    <a href="javascript:document.jsidplay.nextSong()">Next song</a>
  • reset() - to reset the SID player
  • setEffect(int index) - to set one of the default effects. Where 0 is no effect, 1,2,3 is flanger effect, 4,5 is phaser, 6,7 is chorus, 8,9 is echo, 10,11,12 is feedbacked echo, and 13,14 is filter sweeps.

Implementation

The implementation of JSIDPlay is heavily based on JaC64 since SIDs are basically C64 code playing a SID-tune. The CPU, CIA Timers, parts of the VIC emulation and the SID chip from JaC64 are used.
Emulating SID in Java
Emulation of the SID chip have been done on several platforms (which of Amiga was the first, I believe). The challenge to get it working in Java was both performance and the Sound API, especially when I starded before J2SE1.3 when there was no JavaSound ;-). Since JavaSound (javax.sound) it was a much easier task.

The full description on how JSIDPlay works is on the implementation page here.

Joakim Eriksson, joakime@sics.se