OBD:SNDD: Difference between revisions

From OniGalore
Jump to navigation Jump to search
No edit summary
m (sorta done)
Line 1: Line 1:
{{OBD_File_Header | type=SNDD | prev=QTNA | next=StNA | name=Sound Data | family=Generic | align=center}}
{{OBD_File_Header | type=SNDD | prev=QTNA | next=StNA | name=Sound Data | family=Generic | align=center}}


There are 2 different formats used by the SNDD files. Below is the dat file part used in the PC retail version.


=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.


[[image:sndd_all.gif]]
[[image:sndd_all.gif]]
Line 19: Line 22:




The Mac version and the PC demo version use a simpler format and it appears that there is no support for different sample rates (all sounds are sampled at 22050 Hz).
----
==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).




Line 37: Line 43:




The raw data part of a SNDD file contains the actual audio samples without any other headers. 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.
----
 
----
 
=raw=
WAV files
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.
Write "RIFF", add the size of the part in the raw file + 70 byte, write "WAVE", write "fmt ", add the wav header + change it's first byte from 8 to 32, write "data", add the size of the part in the raw file, add the raw file data and save it as a wav file.
===WAV files===
 
*Write "RIFF"
*add the size of the part in the raw file + 70 bytes
*write "WAVE"
*write "fmt "
*add the wav header + change its first byte from 8 to 32
*write "data"
*add the size of the part in the raw file
*add the raw file data
*save it as a wav file.


[[image:sndd_wav.gif]]
[[image:sndd_wav.gif]]
Line 51: Line 65:
{{OBDth}}
{{OBDth}}
{{OBDtrBK|1=Complete ADPCM wav format header (black outline)}}
{{OBDtrBK|1=Complete ADPCM wav format header (black outline)}}
{{OBDtr| 0x00 | char[4]  |FF0000| 52 49 46 46 | RIFF      | identification that this file uses the IBM/Microsoft RIFF standard }}
{{OBDtr| 0x00 | char[4]  |FF0000| 52 49 46 46 | RIFF      | identifier for the "IBM/Microsoft RIFF" standard }}
{{OBDtr| 0x04 | int32    |FFFF00| 9C 28 00 00 | 10396    | size of the wav file from the the green coloured field to the end in bytes (<nowiki>=</nowiki> size of the part in the raw file + 70 bytes) }}
{{OBDtr| 0x04 | int32    |FFFF00| 9C 28 00 00 | 10396    | size of the file from 0x08 to the end (<nowiki>=</nowiki> size of the .raw part + 70 bytes) }}
{{OBDtr| 0x08 | char[4]  |00FF00| 57 41 56 45 | WAVE      | identification that this file is a WAVE file }}
{{OBDtr| 0x08 | char[4]  |00FF00| 57 41 56 45 | WAVE      | identifier for the "WAVE" format }}
{{OBDtr| 0x0C | char[4]  |00FFFF| 66 6D 74 20 | fmt      | identification that the wav format header follows }}
{{OBDtr| 0x0C | char[4]  |00FFFF| 66 6D 74 20 | fmt      | identifier announcing the following wav format header }}
{{OBDtr| 0x10 | block[54]|FFC8C8| &nbsp;      | &nbsp;    | [[OBD:SNDD/wav|wav header]]; note that it starts with a 32 and not with an 8 }}
{{OBDtr| 0x10 | block[54]|FFC8C8| &nbsp;      | &nbsp;    | [[OBD:SNDD/wav|wav header]]; note that it starts with a 32 and not with an 8 }}
{{OBDtr| 0x46 | char[4]  |FFFFC8| 64 61 74 61 | data      | identification that the wav data follows }}
{{OBDtr| 0x46 | char[4]  |FFFFC8| 64 61 74 61 | data      | identifier announcing the following wav data }}
{{OBDtr| 0x4A | int32    |C8FFC8| 56 28 00 00 | 10326    | size of the following wav data in bytes (<nowiki>=</nowiki> size of the part in the raw file) }}
{{OBDtr| 0x4A | int32    |C8FFC8| 56 28 00 00 | 10326    | size of the following wav data in bytes (<nowiki>=</nowiki> size of the .raw part) }}
|}
|}




AIF files
----
 
===AIF files===
 
*Write "FORM"
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, 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.
*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 [[wikipedia:Big Endian|Big Endian]] order


[[image:sndm_aif.gif]]
[[image:sndm_aif.gif]]
Line 72: Line 93:
{{Table}}
{{Table}}
{{OBDth}}
{{OBDth}}
{{OBDtrBK|1=Complete aif format header (black outline) - Note: You have to read the Raw Hex content from left to right}}
{{OBDtrBK|Complete aif format header (black outline) }}
{{OBDtr| 0x00 | char[4]  |FF0000| 46 4F 52 4D | FORM      | identification, that this file uses the "EA IFF 85" standard }}
{{OBDtr| 0x00 | char[4]  |FF0000| 46 4F 52 4D | FORM      | identifier for the "EA IFF 85" standard }}
{{OBDtr| 0x04 | int32    |FFFF00| 00 00 2A 90 | 10896    | size of the file from the the green coloured field to the end in bytes (<nowiki>=</nowiki> size of the part in the raw file + 50 bytes) }}
{{OBDtr| 0x04 | int32    |FFFF00| 00 00 2A 90 | 10896    | size of the file from 0x08 to the end (<nowiki>=</nowiki> size of the .raw part + 50 bytes) }}
{{OBDtr| 0x08 | char[4]  |00FF00| 41 49 46 43 | AIFC      | identification, that this file is a AIFC file (compressed aif file) }}
{{OBDtr| 0x08 | char[4]  |00FF00| 41 49 46 43 | AIFC      | identifier for the "AIFC" format (compressed aif file) }}
{{OBDtr| 0x0C | char[4]  |00FFFF| 43 4F 4D 4D | COMM      | identification that the aif format header follows }}
{{OBDtr| 0x0C | char[4]  |00FFFF| 43 4F 4D 4D | COMM      | identifier announcing the following aif format header }}
{{OBDtr| 0x10 | block[26]|FFC8C8| &nbsp;      | &nbsp;    | [[OBD:SNDD/aif|aif header]] }}
{{OBDtr| 0x10 | block[26]|FFC8C8| &nbsp;      | &nbsp;    | [[OBD:SNDD/aif|aif header]] }}
{{OBDtr| 0x2A | char[4]  |FFFFC8| 53 53 4E 44 | SSND      | identification that the aif data follows }}
{{OBDtr| 0x2A | char[4]  |FFFFC8| 53 53 4E 44 | SSND      | identifier announcing the following aif data }}
{{OBDtr| 0x2E | int32    |C8FFC8| 00 00 2A 66 | 10854    | size of the file from the the light blue coloured field to the end (<nowiki>=</nowiki> size of the part in the raw file + 8 bytes) }}
{{OBDtr| 0x2E | int32    |C8FFC8| 00 00 2A 66 | 10854    | size of the file from 0x32 to the end (<nowiki>=</nowiki> size of the .raw part + 8 bytes) }}
{{OBDtr| 0x32 | int32    |C8FFFF| 00 00 00 00 | 0        | offset; determines where the first sample in the data starts; in Oni it's always zero }}
{{OBDtr| 0x32 | int32    |C8FFFF| 00 00 00 00 | 0        | offset; determines where the first sample in the data starts; in Oni it's always zero }}
{{OBDtr| 0x36 | int32    |FFC8FF| 00 00 00 00 | 0        | block size; used in conjunction with offset for block-aligning data; in Oni it's always zero }}
{{OBDtr| 0x36 | int32    |FFC8FF| 00 00 00 00 | 0        | block size; used in conjunction with offset for block-aligning data; in Oni it's always zero }}

Revision as of 21:16, 18 November 2007

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 block[54]     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 "
  • add the wav header + change its first byte from 8 to 32
  • 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 block[54]     wav header; note that it starts with a 32 and not with an 8
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