Jump to content

OBD:SNDD: Difference between revisions

m
(→‎WAV files: recommendations)
Line 84: Line 84:
{{OBDtr| 0x4A | int32    |C8FFC8| 56 28 00 00 | 10326    | size of the following wav data in bytes (<nowiki>=</nowiki> size of the .raw part) }}
{{OBDtr| 0x4A | int32    |C8FFC8| 56 28 00 00 | 10326    | size of the following wav data in bytes (<nowiki>=</nowiki> size of the .raw part) }}
|}
|}
The above is not 100% consistent with the WAVE storage rules, because it allows for a completely arbitrary "data" size. Microsoft ADPCM data is supposed to be stored as a number of fixed-size blocks (in Oni, each block is either 512 bytes for 22.05kHz mono, or 1024 bytes for 22.05kHz stereo and 44.1kHz mono) and, according to the standard, the last block, even if incomplete, must be stored in its entirety, and the "data" size must be a multiple of the block size. Thus, for the above example (22.05kHz mono), the "data" size should be increased from 10326 to 10752=21x512, and 426 empty bytes should be added as padding, so that there are 21 complete data blocks. The standard way to specify the ''actual'' number of samples is to add a "fact" section to the WAVE header, like this:
The above is not 100% consistent with the WAVE storage rules, because it allows for a completely arbitrary "data" size. Microsoft ADPCM data is supposed to be stored as a number of fixed-size blocks (in Oni, each block is either 512 bytes for 22.05kHz mono, or 1024 bytes for 22.05kHz stereo and 44.1kHz mono). Thus, according to the standard, the last block - even if incomplete - must be stored in its entirety, and the "data" size must be a multiple of the block size. In the above example, since the format is 22.05kHz mono, the "data" size should be increased from 10326 to 10752=21x512, and 426 empty bytes should be added as padding, so that there are 21 complete data blocks. The standard way to specify the ''actual'' number of samples is to add a "fact" section to the WAVE header, like this:
{{Table}}
{{Table}}
{{OBDth}}
{{OBDth}}