OBD:SNDD/wav: Difference between revisions

m
replaced formula GIFs with Math markup; replaced nowiki tags around equals signs with new {{=}} magic word
m (cleaning up commented-up blocks (my own), for great justice)
m (replaced formula GIFs with Math markup; replaced nowiki tags around equals signs with new {{=}} magic word)
 
Line 40: Line 40:
{{OBDtr| 0x0C | char[4]  |00FFFF| 66 6D 74 20 | "fmt "    | identifier announcing the following "fmt " (format) section }}
{{OBDtr| 0x0C | char[4]  |00FFFF| 66 6D 74 20 | "fmt "    | identifier announcing the following "fmt " (format) section }}
{{OBDtr| 0x10 | uint32  |FFC8C8| 10 00 00 00 | 16        | content size for the "fmt " section, in bytes (always 16 for PCM) }}
{{OBDtr| 0x10 | uint32  |FFC8C8| 10 00 00 00 | 16        | content size for the "fmt " section, in bytes (always 16 for PCM) }}
{{OBDtr| 0x14 | uint16  |FFFFC8| '''''01 00'''''      | 1        | format ID (1 <nowiki>=</nowiki> linear PCM format) }}
{{OBDtr| 0x14 | uint16  |FFFFC8| '''''01 00'''''      | 1        | format ID (1 {{=}} linear PCM format) }}
{{OBDtr| 0x16 | uint16  |C8FFC8| '''''02 00'''''      | 2        | number of channels (2 <nowiki>=</nowiki> stereo) }}
{{OBDtr| 0x16 | uint16  |C8FFC8| '''''02 00'''''      | 2        | number of channels (2 {{=}} stereo) }}
{{OBDtr| 0x18 | uint32  |C8FFFF| '''''22 56 00 00''''' | 22050    | sample rate in Hz (samples per second), a.k.a. "sampling frequency" }}
{{OBDtr| 0x18 | uint32  |C8FFFF| '''''22 56 00 00''''' | 22050    | sample rate in Hz (samples per second), a.k.a. "sampling frequency" }}
{{OBDtr| 0x1C | uint32  |FFC8FF| '''''88 58 01 00''''' | 88200    | data rate (<nowiki>=</nowiki> "sample rate" * "block alignment"), in bytes per second
{{OBDtr| 0x1C | uint32  |FFC8FF| '''''88 58 01 00''''' | 88200    | data rate ({{=}} "sample rate" * "block alignment"), in bytes per second
:<small>'''N.B.''' For PCM, there is one block per sample, hence the simple formula.</small> }}
:<small>'''N.B.''' For PCM, there is one block per sample, hence the simple formula.</small> }}
{{OBDtr| 0x20 | uint16  |FFC800| '''''04 00'''''      | 4        | block alignment a.k.a "block size", in bytes
{{OBDtr| 0x20 | uint16  |FFC800| '''''04 00'''''      | 4        | block alignment a.k.a "block size", in bytes
Line 50: Line 50:
{{OBDtr| 0x24 | char[4]  |FF00C8| 64 61 74 61 | data      | identifier announcing the following "data" section }}
{{OBDtr| 0x24 | char[4]  |FF00C8| 64 61 74 61 | data      | identifier announcing the following "data" section }}
{{OBDtr| 0x28 | uint32  |C8FF00| 00 50 09 00 | 610304    | content size for the "data" section, in bytes (implies 152576 stereo sample blocks, 4 bytes each) }}
{{OBDtr| 0x28 | uint32  |C8FF00| 00 50 09 00 | 610304    | content size for the "data" section, in bytes (implies 152576 stereo sample blocks, 4 bytes each) }}
{{OBDtr| 0x2C | block[4] |C800FF| F5 FF F5 FF | (-11,-11) | first stereo sample; the left and the right sample values are both -11<nowiki>=</nowiki>0xFFF5 }}
{{OBDtr| 0x2C | block[4] |C800FF| F5 FF F5 FF | (-11,-11) | first stereo sample; the left and the right sample values are both -11{{=}}0xFFF5 }}
|}
|}
;Mono vs stereo
;Mono vs stereo
Line 125: Line 125:
{{OBDtr| 0x0C | char[4]  |00FFFF| 66 6D 74 20 | "fmt "    | identifier announcing the following "fmt " (format) section }}
{{OBDtr| 0x0C | char[4]  |00FFFF| 66 6D 74 20 | "fmt "    | identifier announcing the following "fmt " (format) section }}
{{OBDtr| 0x10 | uint32  |FFC8C8| 32 00 00 00 | 50        | content size for the "fmt " section, in bytes (typically 50 for MS ADPCM) }}
{{OBDtr| 0x10 | uint32  |FFC8C8| 32 00 00 00 | 50        | content size for the "fmt " section, in bytes (typically 50 for MS ADPCM) }}
{{OBDtr| 0x14 | uint16  |FFFFC8| '''''02 00'''''      | 2        | format ID (2 <nowiki>=</nowiki> MS ADPCM format) }}
{{OBDtr| 0x14 | uint16  |FFFFC8| '''''02 00'''''      | 2        | format ID (2 {{=}} MS ADPCM format) }}
{{OBDtr| 0x16 | uint16  |C8FFC8| '''''02 00'''''      | 2        | number of channels (2 <nowiki>=</nowiki> stereo) }}
{{OBDtr| 0x16 | uint16  |C8FFC8| '''''02 00'''''      | 2        | number of channels (2 {{=}} stereo) }}
{{OBDtr| 0x18 | uint32  |C8FFFF| '''''22 56 00 00''''' | 22050    | sample rate in Hz (samples per second), a.k.a. "sampling frequency" }}
{{OBDtr| 0x18 | uint32  |C8FFFF| '''''22 56 00 00''''' | 22050    | sample rate in Hz (samples per second), a.k.a. "sampling frequency" }}
{{OBDtr| 0x1C | uint32  |FFC8FF| '''''27 57 00 00''''' | 22311    | [[image:sndd_hd1.gif]]
{{OBDtr| 0x1C | uint32  |FFC8FF| '''''27 57 00 00''''' | 22311    | <math>\frac{\text{samples per second}*\text{block alignment}}{\text{samples per block}}</math>
:<small>'''N.B.''' The data rate (in bytes per second) is truncated to the lower integer value.</small> }}
:<small>'''N.B.''' The data rate (in bytes per second) is truncated to the lower integer value.</small> }}
{{OBDtr| 0x20 | uint16  |FFC800| '''''00 04'''''      | 1024      | block alignment a.k.a "block size", in bytes
{{OBDtr| 0x20 | uint16  |FFC800| '''''00 04'''''      | 1024      | block alignment a.k.a "block size", in bytes
Line 134: Line 134:
{{OBDtr| 0x22 | uint16  |00FFC8| '''''04 00'''''      | 4        | bits per sample (per channel); typically 4 bits for MS ADPCM }}
{{OBDtr| 0x22 | uint16  |00FFC8| '''''04 00'''''      | 4        | bits per sample (per channel); typically 4 bits for MS ADPCM }}
{{OBDtr| 0x24 | uint16  |C87C64| '''''20 00'''''      | 32        | size of the following extended format specification, in bytes }}
{{OBDtr| 0x24 | uint16  |C87C64| '''''20 00'''''      | 32        | size of the following extended format specification, in bytes }}
{{OBDtr| 0x26 | uint16  |B0C3D4| '''''F4 03'''''      | 1012      | [[image:sndd_hd2.gif]] }}
{{OBDtr| 0x26 | uint16  |B0C3D4| '''''F4 03'''''      | 1012      | <math>\dfrac{(\text{block alignment}-7*\text{number of channels})*8}{\text{bits per sample}*\text{number of channels}}+2</math> }}
{{OBDtr| 0x28 | uint16  |E7CEA5| '''''07 00'''''      | 7        | number of the following coefficient pairs; always 7 in practice }}
{{OBDtr| 0x28 | uint16  |E7CEA5| '''''07 00'''''      | 7        | number of the following coefficient pairs; always 7 in practice }}
|-align=center valign=top
|-align=center valign=top
| 0x2A || int16-16 || bgcolor="#FFDDDD" | '''''00 01 00 00''''' || 256, 0 || rowspan=7 align=left | The coefficient pairs themselves (always the same in practice).<br>[[image:sndd_hd3.gif]]
| 0x2A || int16-16 || bgcolor="#FFDDDD" | '''''00 01 00 00''''' || 256, 0 || rowspan=7 align=left | The coefficient pairs themselves (always the same in practice).<br><math>\begin{array}{|c|c||c|} \text{coefficient set} & \text{coefficient 1} & \text{coefficient 2} \\
\hline
0 & 256 &    0\\
1 & 512 & -256\\
2 &  0 &    0\\
3 & 192 &  64\\
4 & 240 &    0\\
5 & 460 & -208\\
6 & 392 & -232
\end{array} </math>
|-align=center valign=top
|-align=center valign=top
| 0x2E || int16-16 || bgcolor="#FFDDDD" | '''''00 02 00 FF''''' || 512, -256  
| 0x2E || int16-16 || bgcolor="#FFDDDD" | '''''00 02 00 FF''''' || 512, -256