| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Looking at the document referenced in the issue (emphasis mine):
In this PR, the size includes the padding byte. Which is right? |
Sorry, something went wrong.
wave.Wave_write now writes the required RIFF pad byte when the data chunk size is odd. Update RIFF chunk size calculations in both header writing and header patching so they include the alignment pad byte when present. Add a regression test in test_wave.py that verifies odd-sized writes are padded, RIFF size is correct, and roundtrip reads preserve frame data.
Sure, and thanks for following up!! Plus, I've rebased the commit so it now applies cleanly after my other PRs affecting wave.py plus the tests. The spec quote "ckSize does not include the pad byte" applies to each sub-chunk's own ckSize. The RIFF form's ckSize represents total file content minus the 8-byte RIFF header, which physically includes the pad byte. I double-checked this with libsndfile (what audacity uses) and it does exactly the same thing as this fix. I verified this against libsndfile 1.2.2: for 1 byte of audio it writes data ckSize = 1 and RIFF ckSize = 38 (= 36 + 1 + 1), matching this PR exactly. |
Sorry, something went wrong.
|
I see, that makes sense. Thanks for double-checking! |
Sorry, something went wrong.
wave.Wave_write now writes the required RIFF pad byte when the data chunk size is odd. Update RIFF chunk size calculations in both header writing and header patching so they include the alignment pad byte when present. Add a regression test in test_wave.py that verifies odd-sized writes are padded, RIFF size is correct, and roundtrip reads preserve frame data.
| Back | FazBrowse Home | New Git URL |
wave.Wave_write now writes the required RIFF pad byte when the data chunk size is odd.
Update RIFF chunk size calculations in both header writing and header patching so they include the alignment pad byte when present.
Add a regression test in test_wave.py that verifies odd-sized writes are padded, RIFF size is correct, and roundtrip reads preserve frame data.