| | |
| | | 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_)){ |
| | |
| | | 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); |
| | |
| | | // 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_)){ |
| | |
| | | } 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); |
| | |
| | | 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_)){ |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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); |