但是无法连续语音识别。每次都需要先说唤醒词。 然后我根据这个说明
Code: Select all
////////////////////////////////////// Use case 4: Multi dialog after voice wakeup ////////////////////////
+ + wakeup time +
| +-------------+
| | |
| | |
Wakeup Time +-----------+ | +---------+
+--------+ +----------+ +-------+ +---------+ | |
| wakeup | | voice | | music | | voice | | |
| word | | | | | | | | |
Voice level +--+--------+---------+ +------+ +---+ +------------------------------+
| | | | | |
| +----------------+ | | | |
| SUSPEND ON \ | SUSPEND OFF\ | | | | |
| \| \| | | | |
SUSPEND ON +--------------------------------+ +------------------------------------------+
| | | | | |
| +----------+ | +------+ |
| | | | | | |
| | | | | | |
EVENT +---------------------+ +-----------------------------------------------------------+
|\ |\ |\ /| | |\ |\
| \ | \ | \ / | | vad | \ | \
| WAKEUP | VAD | VAD VAD | | off | VAD | WAKEUP
+ START + START + STOP START + + time + STOP + END
///////////////////////////////////////////////////////////////////////////////////////////////////////////
每次播放交互语音的时候先调用API SUSPEND ON,播放完交互语音调用SUSPEND OFF
audio_rec_cfg_t cfg = AUDIO_RECORDER_DEFAULT_CFG();
cfg.pinned_core = RECORD_INPUT_TASK_CPU_CORE;
cfg.read = (recorder_data_read_t)&input_cb_for_afe;
cfg.sr_handle = recorder_sr_create(&recorder_sr_cfg, &cfg.sr_iface);
srHandle = cfg.sr_handle;
srIface = cfg.sr_iface;
//SUSPEND ON
srIface->afe_suspend(srHandle, true);
do{
srIface->base.get_state(srHandle, &sr_st);
if (sr_st.afe_state == SUSPENDED)
{
ESP_LOGI(TAG, "sr_st.afe_state SUSPENDED");
break;
}
}while(1);
//播放交互语音
if(app_quest_cmd_process(void_cmd_id) == true)
{
mIfStop = false;
}
//SUSPEND OFF
srIface->afe_suspend(srHandle, false);
do{
srIface->base.get_state(srHandle, &sr_st);
if (sr_st.afe_state != SUSPENDED)
{
ESP_LOGI(TAG, "sr_st.afe_state RUNNING");
break;
}
}while(1);
是否能提供个完整的例子。