diff --git a/audioread/rawread.py b/audioread/rawread.py index 2ff476a..5fcb697 100644 --- a/audioread/rawread.py +++ b/audioread/rawread.py @@ -131,6 +131,13 @@ def read_data(self, block_samples=1024): if not data: break + # If the len of the data is not divisible by the width, bytes should be added to the tail + remainder = len(data) % old_width + if remainder != 0: + #data = data + patch_byte * (old_width - remainder) + print("[WARNING] The file might be broken") + break + # Make sure we have the desired bitdepth and endianness. data = audioop.lin2lin(data, old_width, TARGET_WIDTH) if self._needs_byteswap and self._file.getcomptype() != 'sowt':