DSP (File Format): Difference between revisions
Jump to navigation
Jump to search
>Aruki No edit summary |
>Aruki No edit summary |
||
Line 18: | Line 18: | ||
| 0x4 | | 0x4 | ||
| 4 | | 4 | ||
| '''ADPCM nibble count''' | | '''ADPCM nibble count'''; includes frame headers | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
Line 86: | Line 86: | ||
== ADPCM Data == | == ADPCM Data == | ||
The ADPCM audio data is split up into multiple ''frames''. Each frame is 8 bytes; it starts with a one-byte header, then has 7 bytes (or 14 samples) of audio data. For each frame, the bottom 4 bits are the scale value, and the top 4 bits are the coefficient index to use for the current frame. | The ADPCM audio data is split up into multiple ''frames''. Each frame is 8 bytes; it starts with a one-byte header, then has 7 bytes (or 14 samples) of audio data. For each frame header, the bottom 4 bits are the scale value, and the top 4 bits are the coefficient index to use for the current frame. | ||
=== Example C Decoding Function === | === Example C Decoding Function === | ||
Line 121: | Line 121: | ||
u16 scale = 1 << (header & 0xF); | u16 scale = 1 << (header & 0xF); | ||
u8 coef_index = (header >> 4); | u8 coef_index = (header >> 4); | ||
s16 coef1 = d.coefs[coef_index | s16 coef1 = d.coefs[coef_index][0]; | ||
s16 coef2 = d.coefs[coef_index | s16 coef2 = d.coefs[coef_index][1]; | ||
// 7 bytes per frame | // 7 bytes per frame |