Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added format check for method read_data in rawread #70

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions audioread/rawread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down