Serialized Band Envelopes
Band envelopes are optional, their presence is indicated by a flag bit. If that bit is clear, the channel has no envelope info, otherwise, the number of stored band envelopes is stored. These envelopes are assigned to the bands starting at band 0. Another optional feature is envelope replication. If it is enabled, the total number of enveloped bands (should be bigger than the number of envelopes) is stored separately and the last stored envelope is repeated for all bands that don't have an explicit envelope.
The point counts for each band are followed by the Y coordinates of the envelope points for each band, which are in turn followed by all the X coordinates. The point count is between 0 (no envelope present) and 7 (maximum point number). The Y coordinate is between 0 (factor: 2-6) and 15 (factor: 2+9), the X coordinate ranges between 0 and 31 (it is specified in units of four samples of the 128 samples in a band).
Encoding Scheme
- One bit: Enable envelopes, if set:
- Four bits: count of stored envelopes - 1
- One bit: Band replication enable, if set:
- Four bits: Count of bands that have envelopes (bigger than number of stored envelopes) - 1