SupSuper/OpenXcom — pull request #256 by hmaon (2013-01-07 06:56:55+00:00)
Title: insufferable clicks and pops in samples from .CAT files (fixed)

I found several problems affecting samples from .CAT files that resulted in terrible clicks and pops. These were audible at the beginning and end of every sound that played ever.

First, the sound data was not actually 8-bit samples but rather 6-bit. Weird, right? However, it was pretty clear from hex dumps that silence in the data was 0x20 (as opposed to ~0x80 as one would expect for an 8-bit sample.) The result was pops at the beginning and end of samples. It also caused all sounds to play at 1/4 volume. Perhaps this was done to simplify mixing in the original game?

Second, there were five bytes of garbage at the beginning of every sample. The decat.exe tool from tttools.zip found at http://www.ttdpatch.net/chris_becke_ttdlx.html seems to think that these bytes are meant to be four name bytes and a terminating null bytes.

Finally, there's a trailing null byte for no good reason at all.

With those things resolved, the game sounds great!

(This is probably where I found out that it already sounded fine to everyone else and I have some weird version of the data files...)