6 bit RLE compressed PCM format
This format is RLE compressible 6 bit DPCM, it's encoded to single byte for ease to use.
Each output is expanded to 16 bit signed PCM.
Data format (single byte):
Byte format |
Bit |
Description |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
x |
- | - | - | - | - | - | - |
Delta bit |
- |
0 |
x | x | x | x | x | x |
Sound output |
- |
0 | x |
- | - | - | - | - |
Negative bit |
- |
0 | - |
x | x | x | x | x |
Output bit |
- |
1 |
x | x | x | x | x | x |
Repeat previous output update x - 1 time (RLE) |
Delta bit |
Bit |
Description |
0 |
Replace output |
1 |
Add to previous output |
Negative bit |
Bit |
Description |
0 |
Positive |
1 |
Negative |
Output bit |
Bit |
Description |
4 |
3 |
2 |
1 |
0 |
e | e | e | e |
m |
Output = (2 + m) << (e - 1) |
0 | 0 | 0 |
x | x |
Output = x |
X = (X-1 * D) + (Y * 1 - (Neg * 2))
X = -32767 < X < 32767
X = Current output
X-1 = Previous output
D = Delta bit
Y = Next output
Neg = Negative bit