refactor: cap waveform decode length + guard frombuffer + tighten test
This commit is contained in:
+3
-1
@@ -32,4 +32,6 @@ def load_region_samples(path: str, start: float, duration: float,
|
||||
return np.zeros(0, dtype="float32")
|
||||
if proc.returncode != 0 or not proc.stdout:
|
||||
return np.zeros(0, dtype="float32")
|
||||
return np.frombuffer(proc.stdout, dtype="float32")
|
||||
buf = proc.stdout
|
||||
buf = buf[: len(buf) - (len(buf) % 4)]
|
||||
return np.frombuffer(buf, dtype="float32")
|
||||
|
||||
Reference in New Issue
Block a user