From 68a3d8caf25c836e40cbca988a6e2f15cd798587 Mon Sep 17 00:00:00 2001 From: Alex Murkoff <79400603+alexlnkp@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:03:03 +0700 Subject: [PATCH] fix(audio): use np.frombuffer() instead of direct conversion of the resampled frames this fixes traceback on preprocessing --- infer/lib/audio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infer/lib/audio.py b/infer/lib/audio.py index ce57bfe..61acc5b 100644 --- a/infer/lib/audio.py +++ b/infer/lib/audio.py @@ -53,7 +53,7 @@ def load_audio(file: str, sr: int) -> np.ndarray: except Exception as e: raise RuntimeError(f"Failed to load audio: {e}") - return audio.flatten() + return np.frombuffer(audio, dtype=np.float32).flatten() def downsample_audio(input_path: str, output_path: str, format: str) -> None: if not os.path.exists(input_path): return