探讨小爱同学自定义唤醒词

您所在的位置:网站首页 爱没有定义 探讨小爱同学自定义唤醒词

探讨小爱同学自定义唤醒词

2024-07-08 00:56| 来源: 网络整理| 查看: 265

本帖最后由 eastonhe 于 2018-12-5 12:35 编辑

在小爱系统目录/usr/share/xiaomi/wakeup_model/graph下有两个txt文件,分别是words.txt、phones.txt,文件名直译中文就是“词语”以及“音素”。 文件里面的内容就是唤醒词“小爱同学”的拆分。

words.txt: 0 !SIL 1 AI 2 AI-TONG-XUE 3 FL 4 TONG 5 TONG-XUE 6 XIAO 7 XIAO-AI 8 XIAO-AI-TONG 9 KW 10 XUE 11 #0 12 13 14

phones.txt: 0 SIL 1 aa 2 ai 3 filler 4 iao 5 ong 6 t 7 ue 8 x 9 #0 10 #1 11 #2 12

但是,修改后我这边是没有任何的效果,只在第一次修改的时候出现过不响应”小爱同学"唤醒词,但重启后都无法复现这种效果。

然后找到管理小爱唤醒的进程是:/usr/bin/mipns-sai该进程会调用/bin/wakeup.sh以作出回复,(在这个文件内可以把音频名称改掉,这样唤醒小爱的时候小爱就不会回答"欸\在\我在"了)。

用记事本打开mipns-sai的内容是: 能显示出来的估计是代码注释。vc提示乱码文件不能打开。

(这里乱码若干)

libsai_miAPIs.so set_unwakeup_status set_wakeup_status __gmon_start__ _ITM_deregisterTMCloneTable _ITM_registerTMCloneTable get_wake_word_length set_voip_flag start_service pthread_create init_system terminate_system shut_wake_key_word enable_energy_provision enable_local_vad pthread_detach libasound.so.2 snd_dummy_init snd_dummy_generate_file snd_dummy_set_trigger libpthread.so.0 sem_post sem_trywait sem_init pthread_mutex_unlock __errno_location pthread_cond_signal pthread_mutex_lock pthread_self pthread_mutex_destroy pthread_cond_wait read pthread_cond_destroy sem_wait pthread_cond_init sem_destroy pthread_mutex_init libz.so.1 libmibrain-common-sdk.so mibrain_notify_mitv_rec mibrain_notify_mitv_stop mibrain_notify_mitv_init mibrain_pre_start mibrain_notify_mitv_fini mibrain_fini mibrain_session_inactivate mibrain_start mibrain_notify_mitv_start mibrain_add_end mibrain_add_buffer mibrain_stop mibrain_init mibrain_notify_mitv_vol libmibrain-common-util.so libubox.so libubus.so libjson-c.so.2 libdl.so.2 libmdspeech.so mdspeech_delete mdspeech_send_wakeup_results mdspeech_enable mdspeech_disable mdspeech_create libgcc_s.so.1 libc.so.6 strcpy fopen strncmp puts unlink putchar mkdir realloc abort popen getpid strtof syslog fgetc fgets calloc strlen openlog memset __posix_getopt memcpy fclose optarg __sysv_signal pclose fwrite gettimeofday backtrace localtime strchr sleep backtrace_symbols access mkfifo strerror __libc_start_main closelog snprintf free __xstat _edata __bss_start __bss_start__ __bss_end__ __end__ GLIBC_2.17

(这里乱码若干)

enter mipns energy callback! enter mipns oneshot cb(event: %d)! mipns vad normal, do nothing!(now: %lu.%lu) mipns vad begin, do nothing!(now: %lu.%lu) mipns vad end!(now: %lu.%lu) mipns vad timeout(do it like a end)!(now: %lu.%lu) oneshot in voip mode, do nothing! force mitv to stop! /bin/wakeup.sh think & mipns oneshot after sem post! mipns oneshot after sem wait! enter mipns ivw data cb! ivw data len: %u invalid wakeup word: %d w WuW audio file(%s) open failed, errno: %d, %s {awaken,time:%04d-%02d-%02dT%02d:%02d:%02d.%d} enter mipns asr cb! asr data size: %d asr interval: %ld invalid null pointer! asr in voip mode, do nothing! enter sigsegv handler! backtrace: %d backtrace_symbols failed!

USAGE: %s -c [-t ] [-v] [-l] [-r ] [-h]    -c         config file path   -t    sensitivity of wake-up. Default value is 0.4   -v                      enable voip or not(Default)   -l                      enable local vad or not(Default)   -r          enable codec(bv32float / bv32fixed / opus32 / opus64) or not(Default)   -h                      print usage info enter mipns start new session! mibrain start failed, %d misWuW enter mipns asr cache cb! asr cache cb after sem wait! enter mipns do new wakeup! logger stat_points_none micolog_wakeup_xmds_count=1 & enter mipns do mitv new wakeup! logger stat_points_none micolog_wakeup_xatx_count=1 & enter mipns do mibrain new wakeup! need to stop old session: %llu! logger stat_points_none micolog_wakeup_dup_count=1 & mipns do new wakeup failed! mitv add buffer! !!!mipns close mic mitv!!! /bin/wakeup.sh ready %d %s %s & mitv maybe disabled! reco end occurred before vad end and add_buffer failed! mibrain add buffer 0! mibrain add buffer failed: %d end of speech by cloud! unexpected error before vad end detected!(now: %lu.%lu) !!!mipns start new reco repeat session!!! !!!mipns close mic!!! asr total: %llu(bytes), duration: %llu(ms) !!!need to shut wakeup led!!! !!!need to shut think led!!! enter mipns memory spy! cat /proc/%d/statm command: %s r statm: %s get statm failed, errno: %d, %s cat /proc/meminfo meminfo: %s get meminfo failed, errno: %d, %s !!!mipns start new multi-rounds session!!! export LED_PARENT=pns-general;/bin/shut_led 2 & asr cache cb after sem post! enter mipns asr task start! cat %s /data/mipns/mitv shut_wake_key_word: %d enter mipns signal handler, signo %d SIGHUP received, reload WuW config! enter mipns sighup handler! /tmp/mipns/config buffer: %s enter mipns dynamic config handler! unexpected dynamic config: %s: %s SIGSEGV received, call backtrace! unexpected signal! enter mipns wakeup led adjust! led before adjust: %d led after adjust: %d enter mipns real wakeup cb! real wakeup failed: %d, asr status: %d we should stop asr here! real wakeup in voip mode, stop asr only! /sys/class/gpio/gpio59/value gpio59 is %c Because of this microphone is knowles, so wakeup angle need plus 180 degree. [%d] Can't open /sys/class/gpio/gpio59/value wakeup with noangle(%d) real wakeup after sem wait! enter mipns play wakeup! /bin/wakeup.sh noangle /bin/wakeup.sh bf %d & command: %s! touch /data/mipns/first_wakeup && rm /data/mibrain/first_wakeup first_wakeup ENOENT! touch /data/mipns/first_wakeup /bin/wakeup.sh WuW_first first_wakeup tone finished! /bin/wakeup.sh WuW & real wakeup after sem post! enter mipns audio data cb! audio data len: %u ignore audio data in %d mode! enter mipns audio data to voip! /tmp/mico-voip/audio.fifo open fifo failed, errno: %d, %s write fifo failed, errno: %d, %s enter mipns wakeup cb! unexpected wakeup result: %d maybe first wakeup tone is playing, ignore this one! mipns_distrib_wakeup_invoke failed, assume it's a real wakeup! enter mipns supervisor task start! /tmp/mipns/pnshelper.fifo %s make failed, errno: %d, %s open interrupted, retry! %s open failed, errno: %d, %s read interrupted, retry! read failed and waitting for next writer, errno: %d, %s read eof, waitting for next writer! read: %d ttsfinish ttsfinish read! enter mipns supervisor do multirounds! not in multirounds mode! multi-rounds commad: %s micon micon read! enter mipns supervisor do micon! mic on only allowed on idle session! start new session failed! micoff micoff read! enter mipns supervisor do micoff! mic off do on busy session! distribon distribon read! enter mipns supervisor do distrib wakeup op! distriboff distriboff read! unexpected %s read! mipns-sai bv32float bv32fixed opus32 opus64 hc:t:vlr: Please set config file path! /tmp/mipns/ /tmp/mipns/soundai /tmp/mipns/soundai/wuw_dump/ /tmp/mipns/soundai/asr_dump/ /data/mipns/ %s%s_wuw_xatx.pcm %s%s_wuw_xmds.pcm enter mipns session ctx init! mibrain_init finished! mibrain_notify_mitv_init finished! enter mipns asr task init! mipns asr task create failed, errno: %d, %s asr task(%lu) create ok! mipns_asr_task_init finished! enter mipns supervisor task init! mipns supervisor task create failed, errno: %d, %s supervisor task(%lu) create ok! mipns_supervisor_task_init finished! mipns_distrib_wakeup_init finished! mipns_mic_dummy_init finished! sai_mi2017_xm78675x2j90 init system failed, %d Start service failed: %d start_service finished! start main loop! enter mipns session ctx fini! nothing to del! enter mipns asr cache init! memory alloc for asr cache node failed! memory alloc for asr cache buffer failed! enter mipns asr cache fini! enter mipns asr cache in! no free cache! realloc buffer(from: %d, to: %d) realloc buffer failed! enter mipns asr cache out! active cache is empty! enter mipns asr cache free! enter mipns distrib wakeup init! cat /data/mipns/distrib_wakeup distrib wakeup: %s mdspeech_create failed! enter mipns distrib wakeup fini! mdspeech_delete failed! enter mipns distrib wakeup invoke! wakeup_word_len: %d, wakeup_result: %d, wakeup_angle: %f              蝝@     Wo@     enter mipns mic dummy task start! snd_dummy_generate_file ret: %d, %s enter mipns mic dummy init! enter mipns mic dummy workspace init! mic dummy workspace stat failed, errno: %d, %s mkdir -p /tmp/mipns/xiaomi/wuw_dump mipns_mic_dummy_workspace_init failed! enter mipns mic dummy ctx init! uci get system.pns.dummydev system.pns.dummydev: %s /tmp/mipns/xiaomi/wuw_dump/xiaomi_wuw_xatx.opus snd_dummy_init failed, %d snd_dummy_set_trigger failed, %d enter mipns mic dummy task init! mipns mic dummy task create failed, errno: %d, %s mipns mic dummy task(%lu) create ok! mic dummy task init failed! enter mipns mic dummy fini! enter mipns mic dummy ctx fini! enter mipns mic dummy invoke (wakeup_word: %d)! mic dummy disabled! /tmp/mipns/xiaomi/wuw_dump/xiaomi_wuw_xmds.opus   

(这里乱码若干)

GCC: (OpenWrt/Linaro GCC 4.8-2014.04 unknown) 4.8.3  .shstrtab .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .text .fini .rodata .eh_frame .init_array .fini_array .dynamic .got .got.plt .data .bss .comment   

(这里乱码若干)

-------------------------------------------------------------------------------------------- 接下来走进了个死胡同,看看群里的大神们有没有思路。

相关线索目录及文件: /usr/share/xiaomi /usr/share/xiaomi/model/conf/mfcc.conf /usr/share/xiaomi/model/global_cmvn.stats /data/mipns /usr/share/sai/sai_config.txt 里的 wakeupmode 1234

语音识别系统:kaldi version = xaudio_1.0.11.0; 猜测: 1、可能唤醒词不在此目录,或存放在多处。 2、可能唤醒词在缓存文件中而未清理 3、唤醒词可能已被被编译进程序中,这些是老版本的文件,现已经无作用

记录: 1、/bin/wakeup.sh 控制唤醒后回复以及led、网络相关状态,尝试在此处修改。 2、mipns-sai与唤醒有关,缺失此文件则无法唤醒。 3、在/usr/bin/pns_upload_helper 中发现“wakeup_vendor 灏忕埍鍚屽 wakeup_word 灏忕背鐢佃”字句。百度搜“灏忕背”是“小米”的乱码,但缺失此文件依然可以唤醒小爱。怀疑已经写死在程序中。

思路: 1、小爱同学的麦克风只要没有关闭,则在后台一直识别并等待关键词“小爱同学”出现。 “start main loop! enter mipns session ctx fini! nothing to del! enter mipns asr cache init! ” 在mipns-sai注释中,猜测是循环读取asr中是否存在"小爱同学"字眼,有则响应。尝试能否在asr中注入"小爱同学" 2、/tmp/mipns/文件夹修改时间会随着时间实时更新,/tmp/mipns/upload文件夹每次成功唤醒小爱会更新,由于建完就删除,所以未能获取缓存文件 3、刷新中获取到/tmp/mipns/upload/soundai_wuw_xatx.pcm及xiaomi_wuw_xatx.opus文件。 soundai_wuw_xatx.pcm:小爱说的话   极限92kb       来源于/tmp/mipns/soundai/wuw_dump xiaomi_wuw_xatx.opus:你对小爱说的话 极限116kb  来源/tmp/mipns/xiaomi/wuw_dump 已加密无法播放。 谈话结束后统一传输到/tmp/mipns/upload/里上传后删除。 根据文件新建时间判断”小爱同学“命令并没有出现在这两个文件中

-------------------12.5------------------------------------------------------------------ 日志中仅在系统初始化的时候,出现过一次类似的关键记录 mico mipns-sai[3229]: enter mipns asr cache init! mico mipns-sai[3229]: dialog record only init for speech vendor! mico mipns-sai[3229]: enter mipns asr task init! mico mipns-sai[3229]: mipns_asr_task_init finished!mico mipns-sai[3229]: SIGHUP received, reload WuW config!mico mipns-sai[3229]: shut_wake_key_word: 2 在修改phones和words后,尝试能否调用该方法。 或修改系统版本号,修改两文件不可写权限,诱导系统同版本ota,再次调用。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3