Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Newer foobar2000 Versions and 'fact' Chunks (Read 367 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Newer foobar2000 Versions and 'fact' Chunks

While attending to a bug report for lossyWAV I dropped some lossyWAV v1.4.2 processed WAV files into foobar2000 v2.1.4 (and v1.6.13) and was surprised to see that the stated duration for each of the files was of the order of 233,031,623 weeks, instead of less than a minute for each. Each processed WAV file contains a new 'fact' chunk, immediately after the 'fmt ' chunk, which stores a null terminated string relating to the processing parameters and when the file was processed. Per the RIFF specification the 'fact' chunk is zero padded to even length as required.

When developing the previous release version of lossyWAV (v1.4.2, released in September 2016) I used foobar2000 in the development process, often dropping lossyWAV processed WAV files and FLAC files containing processed WAV data. At that time the file durations were correctly displayed even with the 'fact' chunk in place.

To double check that this was actually the case, and not the result of faulty memory, I checked today with foobar2000 v1.1.5 and the durations are correctly shown, see attached image.

Has foobar2000 changed in some way in the intervening period such that it no longer tolerates 'fact' chunks?

Re: Newer foobar2000 Versions and 'fact' Chunks

Reply #1
I thought fact chunk was for sample count, primarily in non-PCM formats?

Sounds like I'm supposed to ignore it for PCM, but why are you writing it in first place?
Microsoft Windows: We can't script here, this is bat country.

Re: Newer foobar2000 Versions and 'fact' Chunks

Reply #2
Indeed it is, but given that lossyWAV only processes PCM, I "appropriated" the chunk (in a context where it would not be used) to store the processing settings, e.g. "lossyWAV beta 1.4.3c @ 22/05/2024 16:06:41, --quality standard". While this is not particularly needed when correction files are not created, other than to indicate that the file has already been processed and to issue a warning if the file is reprocessed, it's needed when correction files are created - specifically to allow checks to be performed to see if two files should be merged.

While bughunting I also noticed that later versions of foobar2000 do handle / ignore 'FACT' chunks, but don't ignore 'fact' chunks.


Re: Newer foobar2000 Versions and 'fact' Chunks

Reply #3
https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html points out some ambiguity on when it should/must be present. But from the spec 3.0, page 12:

The fact chunk will be expanded to include any other information required by future WAVE
formats. Added fields will appear following the <dwSampleLength> field. Applications can use
the chunk size field to determine which fields are present.


So it seems you should have had a <dwSampleLength> field first, and then an added field?

Re: Newer foobar2000 Versions and 'fact' Chunks

Reply #4
Thanks *very* much for a link to that specification, as I've never encountered it before and have relied on the Wikipedia pages.

From the same document:

"This chunk is required for all WAVE formats other than WAVE_FORMAT_PCM. It stores file
dependent information about the contents of the WAVE data. It currently specifies the time length of the
data in samples."

Which, to my reading, can be read as the chunk not being needed for PCM at all and that its contents are not fixed (noting the use of "currently" in relation to what is contained in the chunk).

Re: Newer foobar2000 Versions and 'fact' Chunks

Reply #5
Yeah, so Microsoft being Microsoft being unclear, but just indicating that if it is there, you got to have the sample count and currently they haven't thought of more ... but no definite MUST, and not even specifying completely clearly whether it is sample count per channel although it doesn't make sense otherwise.

Checked the BWF spec from 2011. It doesn't say anything more.

Re: Newer foobar2000 Versions and 'fact' Chunks

Reply #6
Fixed on my side in today's build.
Microsoft Windows: We can't script here, this is bat country.

 

Re: Newer foobar2000 Versions and 'fact' Chunks

Reply #7
Many thanks indeed for taking the time, Peter. Very much appreciated.