Music and Sound With Witchaven  10-20-2020 Release 1 © RTCM ETTiNGRiNDER

INTRODUCTION

BRIEFING

INTRODUCTION

If you would like to edit the sound in the Witchaven games, here is some help in doing so. The info here touches on some of the aspects that may not be fully understood.

BRIEFING

These are stored using a simple custom archive format. Basic tools to work with the archives are now available on the download section, Witchaven tool pages.

Sounds are contained in JOESND for both games, while music is in SONGS for Witchaven I and both F_SONGS and W_SONGS for Witchaven II. Which of the two files in Witchaven II gets used appears to depend on what music card setting the game is put on; F_SONGS is used if (sMIDIHardware.wPort == 0x388), that is to say a Sound Blaster card as far as I can tell, otherwise W_SONGS is chosen. In Witchaven I the tracks for different sound cards are all lumped in the single file and selected for the sound hardware by track number.

The music is in HMP format, version 2 (HMIMIDIP013195). In Witchaven II, each of the 15 levels get four tracks; the first two are the regular music and the second pair are battle music. Some tracks are duplicated, for example the two regular music tracks for level 1 are duplicates of the same song. The "level 16" tracks are the menu music (duplicated four times).

Sound effects from JOESND are stored as a raw PCM and may be loaded using Audacity and loading the file with Import > Raw Data. The settings to use are unsigned 8 bit PCM, mono, and 11025 for the sample rate.

The last 4096 bytes of each archive contain the archive index. Each index entry is made up of 3 double words (32 bit values). This allows up to 341 entries plus a final four null bytes. Any unused entries are filled with null bytes.

For both types of archive, the first value in an index entry indicates an offset to the sound or song entry, but you need to multiply the value in the index by 4096 to get the real offset.

The second value is the entry's real length in bytes. Each file packed in the Joe archive is padded at the end with null bytes to reach the next 4096-byte division in the container file. Only the amount of bytes specified should be read.

For JOESND, the third value is the sound's priority (for deciding how important a sound is when playing multiple sound FX at once). For SONGS, the third value might be unused (appears always to be 9). Other archives might likewise ignore the third value.

In both Witchaven and Witchaven II's source code, the file SNDMOD.H attaches names to the sound index numbers. They are unnamed in the archives themselves.