Help - Search - Members - Calendar
Full Version: foobar2000 WAVE header parser bug
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Support - (fb2k)
jkml
I might have found the cause of the "Unable to open item for playback (Seek offset out of range)" error reported in this post.

I generated 10 files using a TTS software, each of them reading a different digit in Cantonese. 4 out of the 10 files could not be loaded by foobar2000 (v0.9.1), resulting in the above error message.

I inspected them with a hex editor and it turned out that these 4 files have something in common: the data chunk size is an odd number.

To test that this was the cause of the error, I incremented the data chunk size in the header by 1, and added a junk byte at the end of the file. Then foobar was able to read and play the file without any problem.

Can the developers look into this problem? Thanks!
ssamadhi97
Not a bug, rather a problem with that TTS software of yours creating invalid wav files.

According to RIFF specification, all chunks must be word-aligned. Correct behaviour for this software would be to write the correct odd data chunk size but pad the data chunk by appending an additional zero byte.

While I agree that it's not exactly graceful behaviour, technically the player isn't doing anything wrong by rejecting broken files.
jkml
QUOTE(ssamadhi97 @ Apr 24 2006, 11:18 PM) *

Not a bug, rather a problem with that TTS software of yours creating invalid wav files.

According to RIFF specification, all chunks must be word-aligned. Correct behaviour for this software would be to write the correct odd data chunk size but pad the data chunk by appending an additional zero byte.

While I agree that it's not exactly graceful behaviour, technically the player isn't doing anything wrong by rejecting broken files.

Thank you for explaining the issue. I did a little bit of research with Wikipedia and Google, and found that RIFF files are essentially IFF files, in which "chunks must begin on even file offsets, as befits the origins of IFF on the Motorola 68000 processor, which couldn't address quantities larger than a byte on odd addresses. Thus a chunk following an odd-length chunk will be preceded by a pad byte."

I also located an old RIFF specification via Google, although I found it strange that Microsoft is not hosting the specification on its web site.
ElementDave
QUOTE(jkml @ Apr 24 2006, 12:27 PM) *


[...]

I did a little bit of research with Wikipedia and Google, and found that RIFF files are essentially IFF files, in which "chunks must begin on even file offsets, as befits the origins of IFF on the Motorola 68000 processor, which couldn't address quantities larger than a byte on odd addresses. Thus a chunk following an odd-length chunk will be preceded by a pad byte."


I just experienced the same error on a small PCM WAVE file. Appending a null byte to the very end of the file allowed playback in foobar. The chunk offset specified in the header referred to an odd address, but changing the value was not necessary. I don't really know anything about audio file formats, so I can't contribute more than that.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.