diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp index a7c01698d..72be6a12f 100644 --- a/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp +++ b/runtime/onnxruntime/bin/funasr-onnx-online-asr.cpp @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) auto& wav_file = wav_list[i]; auto& wav_id = wav_ids[i]; - int32_t sampling_rate_ = -1; + int32_t sampling_rate_ = audio_fs.getValue(); funasr::Audio audio(1); if(is_target_file(wav_file.c_str(), "wav")){ if(!audio.LoadWav2Char(wav_file.c_str(), &sampling_rate_)){ @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) is_final = false; } gettimeofday(&start, NULL); - FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, audio_fs.getValue()); + FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_); gettimeofday(&end, NULL); seconds = (end.tv_sec - start.tv_sec); taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp index 7b725b9b5..57a4cceaa 100644 --- a/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp +++ b/runtime/onnxruntime/bin/funasr-onnx-online-rtf.cpp @@ -52,7 +52,7 @@ void runReg(FUNASR_HANDLE asr_handle, vector wav_list, vector wa // warm up for (size_t i = 0; i < 10; i++) { - int32_t sampling_rate_ = -1; + int32_t sampling_rate_ = audio_fs; funasr::Audio audio(1); if(is_target_file(wav_list[0].c_str(), "wav")){ if(!audio.LoadWav2Char(wav_list[0].c_str(), &sampling_rate_)){ @@ -84,7 +84,7 @@ void runReg(FUNASR_HANDLE asr_handle, vector wav_list, vector wa } else { is_final = false; } - FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, audio_fs); + FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_); if (result) { FunASRFreeResult(result); @@ -98,7 +98,7 @@ void runReg(FUNASR_HANDLE asr_handle, vector wav_list, vector wa if (i >= wav_list.size()) { break; } - int32_t sampling_rate_ = -1; + int32_t sampling_rate_ = audio_fs; funasr::Audio audio(1); if(is_target_file(wav_list[i].c_str(), "wav")){ if(!audio.LoadWav2Char(wav_list[i].c_str(), &sampling_rate_)){ @@ -131,7 +131,7 @@ void runReg(FUNASR_HANDLE asr_handle, vector wav_list, vector wa is_final = false; } gettimeofday(&start, NULL); - FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, audio_fs); + FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_); gettimeofday(&end, NULL); seconds = (end.tv_sec - start.tv_sec); long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); diff --git a/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp b/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp index 99d5be613..3f6267248 100644 --- a/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp +++ b/runtime/onnxruntime/bin/funasr-onnx-online-vad.cpp @@ -141,10 +141,9 @@ int main(int argc, char *argv[]) auto& wav_file = wav_list[i]; auto& wav_id = wav_ids[i]; - int32_t sampling_rate_ = -1; + int32_t sampling_rate_ = audio_fs.getValue(); funasr::Audio audio(1); if(is_target_file(wav_file.c_str(), "wav")){ - int32_t sampling_rate_ = -1; if(!audio.LoadWav2Char(wav_file.c_str(), &sampling_rate_)){ LOG(ERROR)<<"Failed to load "<< wav_file; exit(-1); @@ -172,7 +171,7 @@ int main(int argc, char *argv[]) is_final = false; } gettimeofday(&start, NULL); - FUNASR_RESULT result = FsmnVadInferBuffer(online_hanlde, speech_buff+sample_offset, step, NULL, is_final, audio_fs.getValue()); + FUNASR_RESULT result = FsmnVadInferBuffer(online_hanlde, speech_buff+sample_offset, step, NULL, is_final, sampling_rate_); gettimeofday(&end, NULL); seconds = (end.tv_sec - start.tv_sec); taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);