If it exists is the ID3 chunk always the last chunk in an AIFF file

166 Views Asked by At

I'm trying to write some code for reading and writing the ID3 chunk from an AIFF file.

I know this chunk is optional, but if it exists is it always the last chunk or could it be anywhere. If it is always the last chunk this makes writing changes to the file easier.

2

There are 2 best solutions below

0
Paul Taylor On BEST ANSWER

No I don't think it is, it can one of the first chunks there is nothing to prevent this in the specification.

0
kernelpanic On

I'm not sure about AIFF, but in wav files, the ID3 sub chunk can be anywhere, before or after the data chunk. The way to find it would be to look at the first subchunkID and if it is not the ID3 chunk then check the next 4 bytes, which would be the size of the subchunk, and then you can skip to the head of the next subchunk, based on the previous size and check that ID.

Again I have only worked with .wav files so far, but plan on looking at AIFF soon.