From 592920331caa25bbba8b4379f23dc2ddd589ae22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=B8=E9=9B=81?= Date: Thu, 25 Jan 2024 20:26:23 +0800 Subject: [PATCH 1/3] v1.0.3 --- funasr/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/funasr/version.txt b/funasr/version.txt index 6d7de6e6a..21e8796a0 100644 --- a/funasr/version.txt +++ b/funasr/version.txt @@ -1 +1 @@ -1.0.2 +1.0.3 From 646eda72e3f495b33b48e73949f4a54909bb0de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=BE=E8=81=AA?= Date: Fri, 26 Jan 2024 10:04:19 +0800 Subject: [PATCH 2/3] update clients for 2pass --- runtime/python/websocket/funasr_wss_client.py | 7 +++++++ runtime/websocket/bin/funasr-wss-client-2pass.cpp | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/runtime/python/websocket/funasr_wss_client.py b/runtime/python/websocket/funasr_wss_client.py index 92dc548c3..a2d88890d 100644 --- a/runtime/python/websocket/funasr_wss_client.py +++ b/runtime/python/websocket/funasr_wss_client.py @@ -186,6 +186,13 @@ async def record_from_scp(chunk_begin, chunk_size): if wav_path.endswith(".pcm"): with open(wav_path, "rb") as f: audio_bytes = f.read() + elif wav_path.endswith(".wav"): + import wave + with wave.open(wav_path, "rb") as wav_file: + params = wav_file.getparams() + sample_rate = wav_file.getframerate() + frames = wav_file.readframes(wav_file.getnframes()) + audio_bytes = bytes(frames) else: wav_format = "others" with open(wav_path, "rb") as f: diff --git a/runtime/websocket/bin/funasr-wss-client-2pass.cpp b/runtime/websocket/bin/funasr-wss-client-2pass.cpp index 6533dd556..0cbd10e23 100644 --- a/runtime/websocket/bin/funasr-wss-client-2pass.cpp +++ b/runtime/websocket/bin/funasr-wss-client-2pass.cpp @@ -192,7 +192,10 @@ class WebsocketClient { funasr::Audio audio(1); int32_t sampling_rate = audio_fs; std::string wav_format = "pcm"; - if (funasr::IsTargetFile(wav_path.c_str(), "pcm")) { + if (funasr::IsTargetFile(wav_path.c_str(), "wav")) { + if (!audio.LoadWav(wav_path.c_str(), &sampling_rate, false)) + return; + } else if (funasr::IsTargetFile(wav_path.c_str(), "pcm")) { if (!audio.LoadPcmwav(wav_path.c_str(), &sampling_rate, false)) return; } else { wav_format = "others"; From 8f9a6ba15be8564b12f0018cc3d300a525a48364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=BE=E8=81=AA?= Date: Fri, 26 Jan 2024 10:04:59 +0800 Subject: [PATCH 3/3] update download tools --- runtime/websocket/bin/funasr-wss-server-2pass.cpp | 2 +- runtime/websocket/bin/funasr-wss-server.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/websocket/bin/funasr-wss-server-2pass.cpp b/runtime/websocket/bin/funasr-wss-server-2pass.cpp index ef27d5b4a..4bc413cc5 100644 --- a/runtime/websocket/bin/funasr-wss-server-2pass.cpp +++ b/runtime/websocket/bin/funasr-wss-server-2pass.cpp @@ -207,7 +207,7 @@ int main(int argc, char* argv[]) { std::string s_lm_path = model_path[LM_DIR]; std::string python_cmd = - "python -m funasr.utils.runtime_sdk_download_tool --type onnx --quantize True "; + "python -m funasr.download.runtime_sdk_download_tool --type onnx --quantize True "; if (!s_vad_path.empty()) { std::string python_cmd_vad; diff --git a/runtime/websocket/bin/funasr-wss-server.cpp b/runtime/websocket/bin/funasr-wss-server.cpp index 8f2a7ab68..bff4f6612 100644 --- a/runtime/websocket/bin/funasr-wss-server.cpp +++ b/runtime/websocket/bin/funasr-wss-server.cpp @@ -187,7 +187,7 @@ int main(int argc, char* argv[]) { std::string s_itn_path = model_path[ITN_DIR]; std::string s_lm_path = model_path[LM_DIR]; - std::string python_cmd = "python -m funasr.utils.runtime_sdk_download_tool --type onnx --quantize True "; + std::string python_cmd = "python -m funasr.download.runtime_sdk_download_tool --type onnx --quantize True "; if(vad_dir.isSet() && !s_vad_path.empty()){ std::string python_cmd_vad;