Open skitaoka opened 2 years ago
The change is correct but I think the referenced Wikipedia article is a little ambiguous about if they're referencing the filesize/RIFF chunk or subchunks.
This article from Microsoft is a bit clearer:
The RIFF header has the following form:
'RIFF' fileSize fileType (data)
where 'RIFF' is the literal FOURCC code 'RIFF',
fileSize
is a 4-byte value giving the size of the data in the file, andfileType
is a FOURCC that identifies the specific file type. The value offileSize
includes the size of thefileType
FOURCC plus the size of the data that follows, but does not include the size of the 'RIFF' FOURCC or the size offileSize
. The file data consists of chunks and lists, in any order.
So the filesize is the size of the whole file except the "RIFF" (4 bytes) and the fileSize
itself (4 bytes). This agrees with what you've changed. :)
As an addition, this the decode function is broken too and should be fixed. I'm wrong :)
I'm bringing the new fork gopxl/beep up-to-date & I'll include these changes. Tnx!
FileSize must be
(file size) - 8
(except the size field itself and the chunk identifier).cf. https://en.wikipedia.org/wiki/Resource_Interchange_File_Format