shithub: sox

Download patch

ref: 30f28d2e977f59596df0ffc7fd786fadca98bdd1
parent: 909fad8e63a39336d247a39b607f998a27097423
author: Mans Rullgard <mans@mansr.com>
date: Fri Aug 7 12:06:02 EDT 2020

wav: allow valid bits less than sample size

Nothing special action is required for files with number of valid
bits less than the sample size.  The reported precision will be
incorrect, but that is less bad than refusing to process the file
at all.

If the specified valid bits is greater than the sample size, the
file is rejected as per Microsoft recommendation.

--- a/src/wav.c
+++ b/src/wav.c
@@ -571,8 +571,9 @@
         lsx_skipbytes(ft, 14);
         len -= 22;
 
-        if (numberOfValidBits != wav->bitsPerSample) {
-            lsx_fail_errno(ft, SOX_EHDR, "WAVE file fmt with padded samples is not supported yet");
+        if (numberOfValidBits > wav->bitsPerSample) {
+            lsx_fail_errno(ft, SOX_EHDR,
+                           "wValidBitsPerSample > wBitsPerSample");
             return SOX_EOF;
         }