在凱比同學執行
mRobot.startSpeech2Text(false);
當語音辨識完成後,會跑三次的
onSpeech2TextComplete
請問如何區分哪一次才是真正的識別?
onSpeech2TextComplete 疑問?
可以如下區別:
void onSpeech2TextComplete(boolean isError, String speech2Txt)
正常的回呼,第一參數為false, 第二參數為App所設定的TTS string.
onSpeech2TextComplete(false, speech2Txt)
若第二參數為true, 表示有異常,需進一步分析full log.
喚醒後,不說話的情況下,的確有跑了兩次,我在第一次傳入時,執行StartTTS,也許是監聽到機器人自己的聲音所以多跑了一次。
log如下:
12-23 01:22:38.053 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_asr_volume_change, 1, 8]
12-23 01:22:38.072 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_wakeup_result, audio_wakeup_result_ok, {"sst":"wakeup", "id":0, "score":2171, "bos":135950, "eos":137280 ,"keyword":"kai2bi3tong2xue2"}, 14.701635], data=null
send2User:[audio, audio_wakeup_result, audio_wakeup_result_ok, {"sst":"wakeup", "id":0, "score":2171, "bos":135950, "eos":137280 ,"keyword":"kai2bi3tong2xue2"}, 14.701635], data=null
12-23 01:22:38.072 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_wakeup_result, audio_wakeup_result_ok, {"sst":"wakeup", "id":0, "score":2171, "bos":135950, "eos":137280 ,"keyword":"kai2bi3tong2xue2"}, 14.701635]
12-23 01:22:38.072 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onWakeup:true, score:{"sst":"wakeup", "id":0, "score":2171, "bos":135950, "eos":137280 ,"keyword":"kai2bi3tong2xue2"}
robotOnWakeup
12-23 01:22:38.073 1205-2646/tw.com.wistrend.market D/index: 4
12-23 01:22:38.073 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: call setFaceAnswer
12-23 01:22:38.073 1205-2646/tw.com.wistrend.market D/callBackToHTMLByString: playMovie - talk
12-23 01:22:38.075 1205-1285/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
send2User:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
12-23 01:22:38.075 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none]
12-23 01:22:38.075 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeakState:NORMAL, state:NONE
12-23 01:22:38.076 1205-2754/tw.com.wistrend.market D/result: undefined
12-23 01:22:38.080 1205-1320/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
send2User:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
12-23 01:22:38.080 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none]
12-23 01:22:38.081 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeakState:NORMAL, state:NONE
12-23 01:22:38.105 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_speaking], data=null
send2User:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_speaking], data=null
12-23 01:22:38.105 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_speaking]
12-23 01:22:38.106 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeakState:NORMAL, state:SPEAKING
12-23 01:22:38.906 1205-1285/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_complete_fail, Sino TTS error!], data=null
send2User:[tts, tts_complete_fail, Sino TTS error!], data=null
12-23 01:22:38.906 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_complete_fail, Sino TTS error!]
12-23 01:22:39.272 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_complete, tts_complete_ok], data=null
12-23 01:22:39.273 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[tts, tts_complete, tts_complete_ok], data=null
12-23 01:22:39.273 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_complete, tts_complete_ok]
TTS: 說話完畢
+notifyTTSComplete:null
-notifyTTSComplete:null
12-23 01:22:39.273 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onTTSComplete:true
12-23 01:22:39.274 1205-1320/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
send2User:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
12-23 01:22:39.274 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: letUserAskRobot50
12-23 01:22:39.274 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none]
12-23 01:22:39.274 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeakState:NORMAL, state:NONE
12-23 01:22:39.276 1205-1205/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: call setFaceStandby
12-23 01:22:39.276 1205-1205/tw.com.wistrend.market D/callBackToHTMLByString: playMovie - standby
12-23 01:22:39.278 1205-1223/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_none], data=null
send2User:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_none], data=null
12-23 01:22:39.278 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_none]
12-23 01:22:39.279 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:WAKE_UP, state:NONE
12-23 01:22:39.280 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_start], data=null
12-23 01:22:39.281 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_start], data=null
12-23 01:22:39.281 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_start]
12-23 01:22:39.282 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:WAKE_UP, state:START
12-23 01:22:39.286 1205-2754/tw.com.wistrend.market D/result: undefined
12-23 01:22:39.334 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_none], data=null
send2User:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_none], data=null
12-23 01:22:39.334 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_none]
12-23 01:22:39.335 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:WAKE_UP, state:NONE
12-23 01:22:39.337 1205-1285/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_start], data=null
send2User:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_start], data=null
12-23 01:22:39.338 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_start]
12-23 01:22:39.338 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:RECOGNIZE, state:START
12-23 01:22:39.339 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_begin_of_speech], data=null
send2User:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_begin_of_speech], data=null
12-23 01:22:39.340 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_begin_of_speech]
12-23 01:22:39.340 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:RECOGNIZE, state:BEGIN_OF_SPEECH
12-23 01:22:39.524 1205-1285/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_asr_volume_change, 3, 0], data=null
send2User:[audio, audio_asr_volume_change, 3, 0], data=null
12-23 01:22:39.524 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_asr_volume_change, 3, 0]
12-23 01:22:39.564 1205-1223/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_asr_volume_change, 3, 0], data=null
12-23 01:22:43.130 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[audio, audio_asr_volume_change, 3, 0], data=null
12-23 01:22:43.130 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_asr_volume_change, 3, 0]
12-23 01:22:43.131 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_end_of_speech], data=null
12-23 01:22:43.131 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_end_of_speech], data=null
12-23 01:22:43.132 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_end_of_speech]
12-23 01:22:43.132 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:RECOGNIZE, state:END_OF_SPEECH
12-23 01:22:43.254 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_result, audio_speech_result_ok, ], data=null
12-23 01:22:43.254 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[audio, audio_speech_result, audio_speech_result_ok, ], data=null
12-23 01:22:43.254 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_result, audio_speech_result_ok, ]
(語音轉文字):
12-23 01:22:43.254 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_result, audio_speech_result_ok, ], data=null
12-23 01:22:43.254 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeech2TextComplete:true, json:invalid_times:0
12-23 01:22:43.254 1205-1219/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[audio, audio_speech_result, audio_speech_result_ok, ], data=null
12-23 01:22:43.255 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_result, audio_speech_result_ok, ]
(語音轉文字):
12-23 01:22:43.255 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeech2TextComplete:true, json:invalid_times:1
12-23 01:22:43.255 1205-1205/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: call setFaceTalk
12-23 01:22:43.255 1205-1205/tw.com.wistrend.market D/callBackToHTMLByString: playMovie - answer
12-23 01:22:43.261 1205-2754/tw.com.wistrend.market D/result: undefined
12-23 01:22:43.264 1205-1223/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
send2User:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
12-23 01:22:43.265 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none]
12-23 01:22:43.265 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeakState:NORMAL, state:NONE
12-23 01:22:43.278 1205-1320/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_speaking], data=null
send2User:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_speaking], data=null
12-23 01:22:43.278 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_speaking]
12-23 01:22:43.279 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeakState:NORMAL, state:SPEAKING
12-23 01:22:46.135 1205-1285/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_result, audio_speech_result_ok, ], data=null
send2User:[audio, audio_speech_result, audio_speech_result_ok, ], data=null
12-23 01:22:46.135 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_result, audio_speech_result_ok, ]
(語音轉文字):
12-23 01:22:46.135 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeech2TextComplete:true, json:invalid_times:2
12-23 01:22:47.439 1205-1223/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_complete, tts_complete_ok], data=null
send2User:[tts, tts_complete, tts_complete_ok], data=null
12-23 01:22:47.439 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_complete, tts_complete_ok]
TTS: 說話完畢
12-23 01:22:47.439 1205-1223/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
12-23 01:22:47.439 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: +notifyTTSComplete:null
12-23 01:22:47.439 1205-1223/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none], data=null
12-23 01:22:47.439 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: -notifyTTSComplete:null
12-23 01:22:47.440 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onTTSComplete:true
12-23 01:22:47.440 1205-2646/tw.com.wistrend.market D/textId: null
12-23 01:22:47.440 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: mustCallbackSpeechForProject:false
12-23 01:22:47.440 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[tts, tts_rs_speak_status, tts_rs_type_normal, tts_rs_state_none]
12-23 01:22:47.440 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeakState:NORMAL, state:NONE
12-23 01:22:47.440 1205-1205/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: call setFaceStandby
12-23 01:22:47.440 1205-1205/tw.com.wistrend.market D/callBackToHTMLByString: playMovie - standby
12-23 01:22:47.443 1205-1320/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_none], data=null
12-23 01:22:47.444 1205-1320/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_none], data=null
12-23 01:22:47.444 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_recognize, asr_state_none]
12-23 01:22:47.444 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:RECOGNIZE, state:NONE
12-23 01:22:47.445 1205-2754/tw.com.wistrend.market D/result: undefined
12-23 01:22:47.449 1205-1285/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_start], data=null
12-23 01:22:47.449 1205-1285/tw.com.wistrend.market D/xxx_BaseAgent: send2User:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_start], data=null
12-23 01:22:47.449 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_speech_asr_status, asr_listen_type_wakeup, asr_state_start]
12-23 01:22:47.449 1205-2646/tw.com.wistrend.market D/dev.anshun.ai_builder.activity.DannySpeechActivity: onSpeechState1:WAKE_UP, state:START
12-23 01:22:47.546 1205-1223/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_asr_volume_change, 1, 10], data=null
send2User:[audio, audio_asr_volume_change, 1, 10], data=null
12-23 01:22:47.546 1205-2646/tw.com.wistrend.market D/xxx_KiwiAgent: internalHandleEvent:[audio, audio_asr_volume_change, 1, 10]
12-23 01:22:47.586 1205-1218/tw.com.wistrend.market D/xxx_BaseAgent: proxy Svr cmd:[audio, audio_asr_volume_change, 1, 9], data=null
send2User:[audio, audio_asr_volume_change, 1, 9], data=null
@developer-wistrend 在 onSpeech2TextComplete 疑問? 裡說:
12-23 01:22:46.135
程式碼中印出的log:
Log.d(TAG, "onSpeech2TextComplete:" + !isError + ", json:" + json + "invalid_times:" + invalid_times);
發生時間點:
12-23 01:22:43.254
12-23 01:22:43.255
12-23 01:22:46.135