hound icon indicating copy to clipboard operation
hound copied to clipboard

Odd RIFF size when frame width is 1 byte and data chunk has odd number of samples

Open 4LT opened this issue 1 year ago • 0 comments

I think hound is producing malformed WAV files when encoding 1-channel and an odd number of 8-bit samples. Here's my reasoning:

  • As per the documentation I could find (https://www.recordingblogs.com/wiki/wave-file-format) chunks must be 16-bit aligned; if the chunk size is odd, then an additional padding byte is required (I believe this is true of any RIFF format)
  • While individual chunks may have odd-numbered chunk sizes, the RIFF chunk contains only other chunks including their padding bytes
  • Therefore a valid WAV file should always have a RIFF chunk with an even-number size

However, when writing a wave file with an odd number of 8-bit samples, I'm getting files with odd-numbered RIFF sizes.

Tested with Hound v3.5.1

4LT avatar Feb 07 '25 01:02 4LT