OBD:SNDD: Difference between revisions

From OniGalore
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 114: Line 114:


{{OBD_File_Footer | type=SNDD | prev=QTNA | next=StNA | name=Sound Data | family=Generic}}
{{OBD_File_Footer | type=SNDD | prev=QTNA | next=StNA | name=Sound Data | family=Generic}}
{{OBD}}

Revision as of 00:22, 18 July 2010

ONI BINARY DATA
QTNA << Other file types >> StNA
SNDD : Sound Data
switch to XML:SNDD page
Overview @ Oni Stuff
OBD.png


dat

There are 2 different formats used by the SNDD files.

PC retail

Below is the dat file part used in the PC retail version.

Sndd all.gif


Offset Type Raw Hex Value Description
0x00 res_id 01 D7 08 00 2263 02263-comguy_dth2.aif.SNDD
0x04 lev_id 01 00 00 06 3 level 3
0x08 int32 08 00 00 00 8 flags
1 -
2 -
4 -
8 - ADPCM compressed
0x08 block[50]     wav header
0x3E int16 37 00 55 duration in 1/60 seconds
0x40 int32 56 28 00 00 10326 size of the part in the raw file in bytes
0x44 offset 20 10 59 00 00 59 10 20 at this position starts the part in the raw file
0x48 char[24] AD DE dead unused



PC demo and Mac

The Mac version and the PC demo version use a simpler format. It appears that there is no support for different sample rates (all sounds are sampled at 22050 Hz).


Sndd alm.gif


Offset Type Raw Hex Value Description
0x00 res_id 01 D6 08 00 2262 02262-comguy_dth2.aif.SNDD
0x04 lev_id 01 00 00 06 3 level 3
0x08 int32 01 00 00 00 1 "number of channels" (can be 1 for 1 channel or 3 for 2 channels)
0x0C int32 37 00 00 00 55 duration in 1/60 seconds
0x10 int32 5E 2A 00 00 10846 size of the part in the raw file in bytes
0x14 offset 00 B1 01 00 00 01 B1 00 at this position starts the part in the raw file
0x18 char[8] AD DE dead unused




raw

The raw data part of a SNDD file contains the actual audio samples without any other headers.

export and import

To create a wav/aif file one needs to write a file header like below and then write the contents of the raw data part.

WAV files

  • Write "RIFF"
  • add the size of the part in the raw file + 70 bytes
  • write "WAVE"
  • write "fmt "
  • write 50
  • write the wav header
  • write "data"
  • add the size of the part in the raw file
  • add the raw file data
  • save it as a wav file.

Sndd wav.gif

Offset Type Raw Hex Value Description
Complete ADPCM wav format header (black outline)
0x00 char[4] 52 49 46 46 RIFF identifier for the "IBM/Microsoft RIFF" standard
0x04 int32 9C 28 00 00 10396 size of the file from 0x08 to the end (= size of the .raw part + 70 bytes)
0x08 char[4] 57 41 56 45 WAVE identifier for the "WAVE" format
0x0C char[4] 66 6D 74 20 fmt identifier announcing the following wav format header
0x10 int32 32 00 00 00 50 wave format header size
0x14 block[50]     wav header
0x46 char[4] 64 61 74 61 data identifier announcing the following wav data
0x4A int32 56 28 00 00 10326 size of the following wav data in bytes (= size of the .raw part)



AIF files

  • Write "FORM"
  • add the size of the part in the raw file + 50 bytes
  • write "AIFC"
  • write "COMM "
  • add the aif header + calculate its sample rate (always 22)
  • write "SSND"
  • add the size of the part in the raw file + 8 bytes
  • add 8 zero bytes
  • add the raw file data and save it as an aif file.

Note the Big Endian order

Sndm aif.gif


Offset Type Raw Hex Value Description
Complete aif format header (black outline)
0x00 char[4] 46 4F 52 4D FORM identifier for the "EA IFF 85" standard
0x04 int32 00 00 2A 90 10896 size of the file from 0x08 to the end (= size of the .raw part + 50 bytes)
0x08 char[4] 41 49 46 43 AIFC identifier for the "AIFC" format (compressed aif file)
0x0C char[4] 43 4F 4D 4D COMM identifier announcing the following aif format header
0x10 block[26]     aif header
0x2A char[4] 53 53 4E 44 SSND identifier announcing the following aif data
0x2E int32 00 00 2A 66 10854 size of the file from 0x32 to the end (= size of the .raw part + 8 bytes)
0x32 int32 00 00 00 00 0 offset; determines where the first sample in the data starts; in Oni it's always zero
0x36 int32 00 00 00 00 0 block size; used in conjunction with offset for block-aligning data; in Oni it's always zero


ONI BINARY DATA
QTNA << Other file types >> StNA
SNDD : Sound Data
Generic file