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.
Showing the changes to src (1 of 1 file). Show all
Unified · Split
| @@ -571,8 +571,9 @@ static int wav_read_fmt(sox_format_t *ft, uint32_t len) · 570 unmodified lines | |||
| 571 | lsx_skipbytes(ft, 14); | 571 | lsx_skipbytes(ft, 14); |
| 572 | len -= 22; | 572 | len -= 22; |
| 573 | 573 | ||
| 574 | if (numberOfValidBits != wav->bitsPerSample) { | 574 | if (numberOfValidBits > wav->bitsPerSample) { |
| 575 | lsx_fail_errno(ft, SOX_EHDR, "WAVE file fmt with padded samples is not supported yet"); | 575 | lsx_fail_errno(ft, SOX_EHDR, |
| 576 | "wValidBitsPerSample > wBitsPerSample"); | ||
| 576 | return SOX_EOF; | 577 | return SOX_EOF; |
| 577 | } | 578 | } |
| 578 | 579 | ||