Monday, May 3, 2010

Reading Outcast SFX files

I've been replaying Outcast for the umpteenth time, courtesy of Good Old Games' rerelease and still enjoy it tremendously. (Here are some of my notes about why Outcast is cool.)

In a previous post I outlined how to read the contents of the game's archive files. Here I'll describe how the audio files are stored.

Audio files have .sfx extensions and there are vast numbers of them. They are compressed using the GSM 06.10 cell phone audio compression standard. All the audio files have a 20-byte header followed by a sequence of 33-byte frames of GSM data. Since this is a cell-phone audio standard, each frame can be decoded independently.

All the headers start with the same 12 bytes: 32 54 76 98 01 00 00 00 00 00 80 3F. After this comes two 4-byte little-endian numbers: the number of bytes of data following the header, which should be divisible by 33; and the sample rate (22050 samples per second in the file I'm looking at).

Each 33-byte frame decodes to 160 16-bit samples, so the compressed data rate is around 4.5 KB per second. I used code by Jutta Degener and Carsten Bormann to decode the frames.

Here's a random snip of dialogue from the game (ilott_found_naarn_g_7-9). Ilott has just learned of his brother's death at the hands of Kroax:

I have not had a chance to play with it, but I suspect that they get some of their “alien voice” sound by monkeying with the parameters of the linear predictive coding used to compress the audio, since it is essentially modeling a vocal tract.

Note: Another person requested the command-line tool for converting the SFX files to WAV format. I dusted it off, updated the project files to the latest version of Visual Studio, and put it up on Github: https://github.com/mcneja/sfx2wav. It's just a thin wrapper around the library mentioned above and converts all of the files in a given directory, writing the output files to a specified output directory.

10 comments:

Unknown said...

Hello Mr. Mcneill;
I was hoping to find an email address or some other way of contacting you, but it looks like this will have to do for now.

I'm very interested in being able to convert .sfx files to .wav; it took me the better part of my day to find a solution to properly unpacking the .opk files, only to find another unreadable file format! All the programs I've found online for converting .sfx files are either dead links, or things that don't seem to work properly under Windows 7 64bit, such as sfx2wav, wsfx2wav, and outcastripper.

I make electronic music and have a very vested interest in making the source audio for Outcast sampleable.
I currently have next to no programming knowledge, but am more than willing to build some; in the future I aim to do sound design and scoring for games.

I've downloaded Degenor and Bormann's source code and don't currently have any idea how to approach using it, though given enough time I probably could.
If there are no simple executables for converting .sfx files, will trying to make sense of said code allow me access to the sounds of the game?

Sorry about commenting on something so old! You're practically the only person, from my current google-research, who seems to understand how .sfx files work, especially in how they pertain to Outcast. If you could point me in any sort of direction, that would be so absolutely wonderful :)

-june

James McNeill said...

June,

I attempted to email you the source and executables for decompressing the .sfx files.

Perhaps eventually I will create a Github project for this; it would be nice to have publicly available.

Unknown said...

Thank you for your response; though, I haven't received anything, checking my inbox and spam folders.

Did you send it to juneunit@gmail.com?

CrazyStep said...
This comment has been removed by the author.
CrazyStep said...

James, good afternoon. I am also looking for sfx converter in normal audio format. The same wav. I do a little remake of the game Outcast and not all files can reveal. Can you throw me and this converter? My email: crazystip@gmail.com

James McNeill said...

Sent you the stuff; hope it helps!

Unknown said...

Good afternoon I'm looking for the same audio file, did it went online?
It not could you also send me the converter? Thanks in advance

my email alexlasher8@gmail.com

Unknown said...

Hi there,
I am searching for hours to find a way to convert Outcasts dialogue files from sfx to a wav format.
Can you please help me? I extraced the PAK files but now I am stuck and in search for a program / solution to listen to those hundrets of sfx files.
Mail: info@planet-adelpha.de

Cordially, Fabian

James McNeill said...

I put the command-line tool I made for converting the SFX files to WAV format up on Github: https://github.com/mcneja/sfx2wav

ss619du73@hotmail.fr said...

Hello, sorry to bother you but I'm very eager to get those .wav myself, problem is I'm totally lost.

I have unpacked the .sfx files, and I'm stuck, hours of researches and I'm on the verge of giving up so I try to contact you directly.

I don't know how to run your command in c++, I installed visual studio to try to build an EXE, and it worked but when I try to open it nothing happen, I can't use direct console command because the "G++" prompt don't work and apparently I need to install a whole lot of things for it to work and I'm lost in all of this, isn't it possible to simplify the process ? What am I doing wrong, I have no experience in coding (obvisously)...

Sorry again to bother you and thanks in advance, you're my last hope litteraly x)