When a fmt chunk has the format code 65534 (i.e. WAVE_FORMAT_EXTENSIBLE) it is required to have a chunk extension of 22 bytes containing 3 fields. These fields, especially the final 16 byte "audio format GUID" field, are required in order to correctly read the file's sample data, and don't have sensible default values.
In v1.1.1 of the gem a Reader instance can be created, without any error being raised, for some WAVE_FORMAT_EXTENSIBLE files in which the fmt chunk has a missing/truncated extension. The readable_format? field on the Reader instance will be correctly set to false, so no sample data will be able to be read out of it. However, the object attached to format and native_format will contain invalid values (i.e. either nil or "") for the missing extension fields.
It seems like a bug that Reader instances can be created from files like this. These are malformed files, and some of the information shown in the objects returned by format and native_format will not necessarily be meaningful/accurate. It seems like better behavior would be to instead raise an InvalidFormatError when trying to read this type of file, and not allow a Reader instance to be created.
When a
fmt
chunk has the format code65534
(i.e. WAVE_FORMAT_EXTENSIBLE) it is required to have a chunk extension of 22 bytes containing 3 fields. These fields, especially the final 16 byte "audio format GUID" field, are required in order to correctly read the file's sample data, and don't have sensible default values.In v1.1.1 of the gem a
Reader
instance can be created, without any error being raised, for some WAVE_FORMAT_EXTENSIBLE files in which thefmt
chunk has a missing/truncated extension. Thereadable_format?
field on theReader
instance will be correctly set to false, so no sample data will be able to be read out of it. However, the object attached toformat
andnative_format
will contain invalid values (i.e. eithernil
or""
) for the missing extension fields.It seems like a bug that
Reader
instances can be created from files like this. These are malformed files, and some of the information shown in the objects returned byformat
andnative_format
will not necessarily be meaningful/accurate. It seems like better behavior would be to instead raise anInvalidFormatError
when trying to read this type of file, and not allow aReader
instance to be created.