Skip to content

Commit d5441f4

Browse files
Add wave.Error in clause when loading audio
Sometimes this gets thrown
1 parent d2d9c34 commit d5441f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

precise/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ def load_audio(file: Any) -> np.ndarray:
4646
samples: Sample rate and audio samples from 0..1
4747
"""
4848
import wavio
49+
import wave
4950
try:
5051
wav = wavio.read(file)
51-
except EOFError:
52+
except (EOFError, wave.Error):
5253
wav = wavio.Wav(np.array([[]], dtype=np.int16), 16000, 2)
5354
if wav.data.dtype != np.int16:
5455
raise InvalidAudio('Unsupported data type: ' + str(wav.data.dtype))

0 commit comments

Comments
 (0)