Jump to content

OBD:SNDD: Difference between revisions

2,638 bytes added ,  16 November 2007
no edit summary
m (changed link from "SNDD/Mac" to "SNDD_Mac")
No edit summary
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.
----
<center>'''PC Sound Data'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[OBD:SNDD_Mac|Mac Sound Data]]</center>
----
 
 
Below is the dat file part of the SNDD file.




Line 25: Line 19:




So, how to create playable wav files? Look at the pic below. It shows the beginning of the comguy_dth2.wav sound.
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).
 
 
[[image:sndd_alm.gif]]
 
 
{{Table}}
{{OBDth}}
{{OBDtr| 0x00 | res_id  |FF0000| 01 D6 08 00 | 2262      | 02262-comguy_dth2.aif.SNDD }}
{{OBDtr| 0x04 | lev_id  |FFFF00| 01 00 00 06 | 3        | level 3 }}
{{OBDtr| 0x08 | int32    |FFC8C8| 01 00 00 00 | 1        | "number of channels" (can be 1 for 1 channel or 3 for 2 channels) }}
{{OBDtr| 0x0C | int32    |FFFFC8| 37 00 00 00 | 55        | duration in 1/60 seconds }}
{{OBDtr| 0x10 | int32    |C8FFC8| 5E 2A 00 00 | 10846    | size of the part in the raw file in bytes }}
{{OBDtr| 0x14 | offset  |C8FFFF| 00 B1 01 00 |00 01 B1 00| at this position starts the part in the raw file }}
{{OBDtr| 0x18 | char[8]  |FFC8FF| AD DE      | dead      | unused }}
|}
 
 
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.
 
 
WAV files
 
 
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.




[[image:sndd_wav.gif]]
[[image:sndd_wav.gif]]


{{Table}}
{{Table}}
Line 44: Line 61:




Just 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.
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, 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.
 
 
[[image:sndm_aif.gif]]
 
 
{{Table}}
{{OBDth}}
{{OBDtrBK|1=Complete aif format header (black outline) - Note: You have to read the Raw Hex content from left to right}}
{{OBDtr| 0x00 | char[4]  |FF0000| 46 4F 52 4D | FORM      | identification, that this file uses 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| 0x08 | char[4]  |00FF00| 41 49 46 43 | AIFC      | identification, that this file is a AIFC file (compressed aif file) }}
{{OBDtr| 0x0C | char[4]  |00FFFF| 43 4F 4D 4D | COMM      | identification that the aif format header follows }}
{{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| 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| 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 }}
|}




{{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}}
708

edits