Difference between revisions of "Sound Sample Format (SOUNDS.DAT)"

From WTFwiki
Jump to navigation Jump to search
(Added documentation on the sfx file format)
 
m (Added link to SoX and my sound extractor script)
Line 18: Line 18:
  
 
   sox -r 8000 -u -b -c 1 sound.raw sound.wav
 
   sox -r 8000 -u -b -c 1 sound.raw sound.wav
 +
 +
 +
== External Links ==
 +
 +
* [http://rubyforge.org/viewvc/tools/soundextract.rb?root=rubyomf2097&view=markup My ruby script for extracting sounds]
 +
* [http://sox.sourceforge.net SoX]

Revision as of 23:20, 28 February 2007

Another copy/paste from ChaosBlackMagic's forum post

SOUNDS.DAT:

This file contains all the sound effects used by OMF. It is split into a number of blocks, the first of which is a header block describing where in the file each block begins and ends.

Block 0, the header block, is a sequence s of dwords. Block i is stored in the file from offset s to offset s[i+1]-1. The blocks start at the beginning of the file, so the offset of the header block is 0, the first four bytes of the file are 0x00, and next four bytes of the file contain the length of the header block.

Blocks 1 onwards are sound effects in raw format, with signed 8-bit mono samples. A good typical frequency for playback is 8kHz. OMF has the ability to play these sounds back at other rates, in order to apply a frequency shift to the sound.




I've only been able to extract 64 sounds from the file using this approach, the rest all report just being "\000\000". I'm not sure if that's all of them or what. I'm also not sure how to figure out which sound corresponds to which index in the animation strings when it calls for a sound to be played back...

A useful command to convert the raw files into WAV files is as follows:

 sox -r 8000 -u -b -c 1 sound.raw sound.wav


External Links