Module triseratops::tag::serato32
source · Expand description
These functions convert between a custom 4-byte format (that we’ll call serato32
for brevity)
and 3-byte plaintext (both u32
). Serato’s custom format inserts a single null bit after every 7
payload bits, starting from the rightmost bit.
This format is used to encode the 3-byte RGB color values (track color, cue colors) and the cue
positions and the Serato Markers_
tag.
Binary Format Details
serato32 | Byte1 | Byte2 | Byte3 | Byte4 |
| Nibb1 | Nibb2 | Nibb3 | Nibb4 | Nibb5 | Nibb6 | Nibb7 | Nibb8 |
Bits |A A A A B B B B C C C C D D D D E E E E F F F F G G G G H H H H|
Ignored Bits |^ ^ ^ ^ ^ ^ ^ ^ |
Plaintext ||||||||||| Byte1 | Byte2 | Byte3 |
||||||||||| Nibb1 | Nibb2 | Nibb3 | Nibb4 | Nibb5 | Nibb6 |
More information can be found in the format documentation.
Example
Hex | Binary | |
---|---|---|
3-byte plaintext | 00 00 cc | 000 0000000 0000001 1001100 |
serato32 value | 00 00 01 4c | 00000000000000000000000101001100 |
3-byte plaintext | cc 88 00 | 110 0110010 0010000 0000000 |
serato32 value | 06 32 10 00 | 00000110001100100001000000000000 |
Functions
- Decodes value from Serato’s 32-bit custom format to 24-bit plaintext.
- Encodes 3-byte value to to Serato’s 32-bit custom format.
- Returns a 3-byte tuple decoded from the first 4 input bytes.
- Returns a
Color
decoded from the first 4 input bytes. - Returns a
u32
decoded from the first 4 input bytes.