From 4b3a28cbc5fdeb2410840df8422372b3225db9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=B8=E9=9B=81?= Date: Thu, 28 Nov 2024 15:53:17 +0800 Subject: [PATCH] pcm unfix --- funasr/utils/load_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/funasr/utils/load_utils.py b/funasr/utils/load_utils.py index aabf5d9f3..9613d1b39 100644 --- a/funasr/utils/load_utils.py +++ b/funasr/utils/load_utils.py @@ -138,7 +138,7 @@ def load_audio_text_image_video( def load_bytes(input): - input = validate_frame_rate(input) + # input = validate_frame_rate(input) middle_data = np.frombuffer(input, dtype=np.int16) middle_data = np.asarray(middle_data) if middle_data.dtype.kind not in "iu": @@ -153,11 +153,12 @@ def load_bytes(input): array = np.frombuffer((middle_data.astype(dtype) - offset) / abs_max, dtype=np.float32) return array + def validate_frame_rate( input, fs: int = 16000, ): - + # 将文件读取为字节流 byte_data = BytesIO(input) @@ -175,7 +176,7 @@ def validate_frame_rate( # 获取重新采样后的字节流数据 input = output.read() - + return input