diff --git a/corrscope/utils/scipy/wavfile.py b/corrscope/utils/scipy/wavfile.py index 6b6f01e..6349e20 100644 --- a/corrscope/utils/scipy/wavfile.py +++ b/corrscope/utils/scipy/wavfile.py @@ -482,8 +482,7 @@ def _read_data_chunk(fid, format_tag, channels, bit_depth, is_big_endian, shape=(n_samples,)) fid.seek(start + size) else: - raise ValueError("mmap=True not compatible with " - f"{bytes_per_sample}-byte container size.") + raise ValueError(f"{bytes_per_sample * 8}-bit WAV is not supported.") _handle_pad_byte(fid, size) diff --git a/tests/test_wave.py b/tests/test_wave.py index aaf8843..9c0de68 100644 --- a/tests/test_wave.py +++ b/tests/test_wave.py @@ -50,6 +50,20 @@ def test_incomplete_wav_chunk(): data = wave[:] +def test_24_bit_wav(): + """Tests that WAV files exported from foobar2000 can be loaded properly, + without a `ValueError: Incomplete wav chunk.` exception being raised.""" + + try: + wave = Wave(prefix + "s24-impulse1000.wav") + except ValueError as e: + assert e.args == (f"24-bit WAV is not supported.",) + except Exception as e: + pytest.fail(f"Unexpected exception {e}") + else: + pytest.fail(f"Expected exception loading 24-bit wav, none found") + + # Stereo tests