Descent 1,2 audio: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
(adding descent 1/2 format information)
 
m (Correct formatting on page)
Line 14: Line 14:
As to Descent 1 (v1.0) .PIG file, it has the following header:
As to Descent 1 (v1.0) .PIG file, it has the following header:


struct PIGHeader {
struct PIGHeader {
   DWORD nFiles
   DWORD nFiles
   DWORD nSoundFiles}
   DWORD nSoundFiles}




nFiles -- this is the number of non-sound files in the PIG,
''nFiles'' -- this is the number of non-sound files in the PIG,


nSoundFiles -- this is the number of RAW sounds in the PIG.
''nSoundFiles'' -- this is the number of RAW sounds in the PIG.


Following the header go (nFiles) records describing non-sound files.
Following the header go (''nFiles'') records describing non-sound files.
What we need to know about these records is that each of them is 17 bytes long.
What we need to know about these records is that each of them is 17 bytes long.


After those records go (nSoundFiles) records describing sounds. Each record
After those records go (''nSoundFiles'') records describing sounds. Each record
has the following format:
has the following format:


struct DSNDEntry{
struct DSNDEntry{
   char szFileName[8];
   char szFileName[8];
   DWORD nSamples;
   DWORD nSamples;
   DWORD dwFileSize;
   DWORD dwFileSize;
   DWORD dwFileStart;
   DWORD dwFileStart;
};
};


szFileName -- this is the name for sound padded with zeroes. Note that
''szFileName'' -- this is the name for sound padded with zeroes. Note that
there're some 8 bytes long filenames which are thus not zero-terminated.
there're some 8 bytes long filenames which are thus not zero-terminated.


nSamples -- the number of samples in RAW file.
''nSamples'' -- the number of samples in RAW file.


dwFileSize -- the size of RAW file (in bytes).
''dwFileSize'' -- the size of RAW file (in bytes).


dwFileStart -- the starting position of the RAW file relative to the beginning
''dwFileStart'' -- the starting position of the RAW file relative to the beginning
of data files in PIG. That is, to get the starting position of the RAW file
of data files in PIG. That is, to get the starting position of the RAW file
relative to the beginning of the PIG file you need to add (dwFileStart) to
relative to the beginning of the PIG file you need to add (''dwFileStart'') to
(sizeof(PIGHeader)+nFiles*17+nSoundFiles*sizeof(DSNDEntry)).
''(sizeof(PIGHeader)+nFiles*17+nSoundFiles*sizeof(DSNDEntry))''.


So, starting at that position goes RAW 8-bit unsigned mono data.
So, starting at that position goes RAW 8-bit unsigned mono data.
Line 63: Line 63:
.S11 and .S22 files have the following header:
.S11 and .S22 files have the following header:


struct DSNDHeader{
struct DSNDHeader{
   char szID[4];
   char szID[4];
   DWORD dwDummy;
   DWORD dwDummy;
   DWORD nFiles;
   DWORD nFiles;
};
};


szID -- string ID is always "DSND",
''szID'' -- string ID is always "DSND",


dwDummy -- ??? looks like has no reasonable meaning,
''dwDummy'' -- ??? looks like has no reasonable meaning,


nFiles -- the number of files in .S11/.S22 file.
''nFiles'' -- the number of files in .S11/.S22 file.


After the header go (nFiles) DSNDEntry records (just the same as for Descent 1).
After the header go (''nFiles'') DSNDEntry records (just the same as for Descent 1).
Just like in Descent 1, (dwFileStart) field of each entry is the starting
Just like in Descent 1, (''dwFileStart'') field of each entry is the starting
position of the RAW file relative to the beginning of RAW files. That is,
position of the RAW file relative to the beginning of RAW files. That is,
to get the starting position of the RAW file relative to the beginning of
to get the starting position of the RAW file relative to the beginning of
the .S11/.S22 file you need to add (dwFileStart) to
the .S11/.S22 file you need to add (''dwFileStart'') to
(sizeof(DSNDHeader)+nFiles*sizeof(DSNDEntry)).
''(sizeof(DSNDHeader)+nFiles*sizeof(DSNDEntry))''.


==Playing the Audio==
==Playing the Audio==

Revision as of 13:23, 14 August 2006

Credit

This document is one of the many format documents written up by Valery V. Anisimovsky, and is available on wotsit.org.


Descent 1 Sound FX

In Descent 1 all sound files are stored in DESCENT.PIG file except for one file: DIGITEST.RAW which is in DESCENT.HOG. As to Descent 1 (v1.0) .PIG file, it has the following header:

struct PIGHeader {
 DWORD nFiles
 DWORD nSoundFiles}


nFiles -- this is the number of non-sound files in the PIG,

nSoundFiles -- this is the number of RAW sounds in the PIG.

Following the header go (nFiles) records describing non-sound files. What we need to know about these records is that each of them is 17 bytes long.

After those records go (nSoundFiles) records describing sounds. Each record has the following format:

struct DSNDEntry{
 char	szFileName[8];
 DWORD nSamples;
 DWORD dwFileSize;
 DWORD dwFileStart;
};

szFileName -- this is the name for sound padded with zeroes. Note that there're some 8 bytes long filenames which are thus not zero-terminated.

nSamples -- the number of samples in RAW file.

dwFileSize -- the size of RAW file (in bytes).

dwFileStart -- the starting position of the RAW file relative to the beginning of data files in PIG. That is, to get the starting position of the RAW file relative to the beginning of the PIG file you need to add (dwFileStart) to (sizeof(PIGHeader)+nFiles*17+nSoundFiles*sizeof(DSNDEntry)).

So, starting at that position goes RAW 8-bit unsigned mono data. All sound files in Descent 1 .PIG should be played at 11025 Hz.

1.4 Format

Note that Descent v1.4 has slightly different .PIG file. Namely, it starts with a DWORD value which is the position (relative to the .PIG file beginning) of PIGHeader. Starting at that position is a PIGHeader which is just the same to the described above.

Descent 2 Sound FX

In Descent 2 all sound files are stored in DESCENT2.S11 and DESCENT2.S22 except for DIGITEST.RAW in DESCENT2.HOG. .S11 and .S22 files have the following header:

struct DSNDHeader{
 char	szID[4];
 DWORD dwDummy;
 DWORD nFiles;
};

szID -- string ID is always "DSND",

dwDummy -- ??? looks like has no reasonable meaning,

nFiles -- the number of files in .S11/.S22 file.

After the header go (nFiles) DSNDEntry records (just the same as for Descent 1). Just like in Descent 1, (dwFileStart) field of each entry is the starting position of the RAW file relative to the beginning of RAW files. That is, to get the starting position of the RAW file relative to the beginning of the .S11/.S22 file you need to add (dwFileStart) to (sizeof(DSNDHeader)+nFiles*sizeof(DSNDEntry)).

Playing the Audio

Each file in .S11/.S22 is 8-bit unsigned RAW. RAWs from .S11 should be played at 11025 Hz and from .S22 -- at 22050 Hz.