DSP (File Format): Difference between revisions

no edit summary
>Aruki
>Aruki
No edit summary
Line 82: Line 82:
|}
|}


== Audio 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, the bottom 4 bits are the scale value, and the top 4 bits are the coefficient index to use for the current frame.


Sample decoding code ([https://github.com/kode54/vgmstream/blob/master/src/coding/ngc_dsp_decoder.c vgmstream] used as reference):
=== Example C Decoding Function ===
 
[https://github.com/kode54/vgmstream/blob/master/src/coding/ngc_dsp_decoder.c vgmstream] used as reference:


<syntaxhighlight lang="c">static const s8 nibble_to_s8[16] = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1};
<syntaxhighlight lang="c">static const s8 nibble_to_s8[16] = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1};
Anonymous user