FunCom ISS

From MultimediaWiki
Revision as of 03:06, 21 January 2009 by StefanG (talk | contribs) (Not missing in FFmpeg anymore)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ISS files are audio files with IMA ADPCM audio used in some games from a company named FunCom Oslo A/S, including The Longest Journey.

Credit

The information on this page was originally based on one of the many format documents written up by Valery V. Anisimovsky, available on http://wotsit.org/ and many other sites across the internet.

Byte Order

All multi-byte numbers are stored in little endian format.

ISS File Format

The music, sfx and speech in The Longest Journey are stored in .ISS files which can either occur as standalone files or stored in XARC archives. The ISS file has some kind of a textual header -- the header fields are just decimal string representations of corresponding field values, separated by spaces. To obtain the parameters of an ISS file, a program needs to parse this textual header while being mindful of issues related to parsing freeform text (like buffer overflows).

The following fields should be present in the textual header

  • ID -- ID string, which is "IMA_ADPCM_Sound".
  • BlockSize -- the block size for the audio stream in the file (see below). The music (stereo) files usually set this value to 2048; the speech/sfx (mono) files usually set this value to 512. These values may vary, though.
  • FileID -- the string ID of the given file. It seems to be the internal name for the file (which usually matches the file title for standalone files).
  • OutSize -- total number of audio samples in the file. May be used for song length (in seconds) calculation. (audio samples or audio frames? --Multimedia Mike 20:53, 2 April 2008 (EDT))
  • Stereo -- this seems to be boolean stereo flag: if this is non-zero, the audio stream in the file is stereo (music), otherwise it's mono (sfx, speech).
  • Unknown1 -- the unknown field. All ISS files in The Longest Journey have this field set to 1.
  • RateDivisor -- the value which determines sample rate for the file: the sample rate is equal to (44100 / RateDivisor). E.g., a RateDivisor of 2 indicates that the audio data should be played back at 22050 Hz.
  • Unknown2 -- the unknown field. All ISS files in The Longest Journey have this value set to 0.
  • Version -- version ID string. All files in The Longest Journey have this set to "1.000". Note that this field may, in principle, vary.
  • Size -- the size of the audio stream in the file. The total filesize is the sum of the header size plus this value.

ISS IMA ADPCM

After the header, the ISS file contains IMA ADPCM-compressed sound data. The stream is divided into the blocks of BlockSize bytes. Each block in a mono stream begins with a header that contains the initial values for IMA ADPCM decompression:

 UI16:  initial sample
 UI16:  initial index

In a stereo stream, each chunk begins with such headers, one for the left channel and one for the right:

 UI16:  left channel initial sample
 UI16:  left channel initial index
 UI16:  right channel initial sample
 UI16:  right channel initial index

Use this initial state to set up the IMA ADPCM decoder. Then, march along the bytes in the block and decode the audio. If the audio is mono data, the low nibble is decoded first (bits 3-0) then the high nibble:

   byte0 byte1 byte2 byte3 ...
    n1n0  n3n2  n5n4  n7n6 ... 

If the audio is stereo data, the high nibble corresponds to the left channel while the low nibble corresponds to the right channel:

   byte0 byte1 byte2 byte3 ...
   L0 R0 L1 R1 L2 R2 L3 R3 ...

ISS Audio Files in XARC Archives

When stored in .XARC resources, ISS audio files are stored "as is", without compression or encryption. That means if you want to play/extract an ISS file from the XARC resource you just need to search for ID id-string ("IMA_ADPCM_Sound") and read the ISS header starting at the beginning position of the ID string. This will give you starting point of the file and the size of the file will be the sum of header size (its size may vary) and dwSize.