Skip to content
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
2 changes: 1 addition & 1 deletion src/utils/fastio.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def read(path:str, insure_2d:bool=True, target_sampling_rate=None, logger=None)-

if signal is None:
try:
signal, sampling_rate = sf.read(path)
signal, sampling_rate = sf.read(path, dtype='float32')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change correctly addresses the data type mismatch. To ensure this fix is robust and to prevent future regressions, it would be beneficial to add a unit test. The test file tests/utils/test_fastio.py is currently empty. A test case could be added there to specifically verify that when soundfile.read is used as a fallback, the resulting audio data has the float32 dtype.

except Exception as e:
if logger:
logger.warning(f"soundfile failed to read {path} with error {e}")
Expand Down