| | |
| | | // 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, nullptr, 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_)){ |
| | |
| | | } else { |
| | | is_final = false; |
| | | } |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, audio_fs); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | n_total_time += taking_micros; |
| | |
| | | GetValue(wav_path, WAV_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_HANDLE asr_handle=FunASRInit(model_path, 1, ASR_ONLINE); |
| | | |
| | | if (!asr_handle) |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |