Also make sure you test encoding > 2 channels. I guarantee you that will break as well. The _minimum_ header size is 19 bytes. It will be larger with a multichannel mapping (for mapping family 1, an extra 2 bytes plus 1 byte per channel).