Skip to content

troubleshooting

潘伟洲 edited this page Apr 5, 2020 · 12 revisions

常见问题解答

启动报错

No module named _snowboydetect

Traceback (most recent call last):
File "wukong.py", line 2, in 
from snowboy import snowboydecoder
File "/home/pi/wukong-robot/snowboy/snowboydecoder.py", line 5, in 
from . import snowboydetect
File "/home/pi/wukong-robot/snowboy/snowboydetect.py", line 17, in 
_snowboydetect = swig_import_helper()
File "/home/pi/wukong-robot/snowboy/snowboydetect.py", line 16, in swig_import_helper
return importlib.import_module('_snowboydetect')
File "/usr/lib/python2.7/importlib/**init**.py", line 37, in import_module
**import**(name)
ImportError: No module named _snowboydetect

答:你需要确保两个事情:

  1. 使用 Python 3 执行本程序;
  2. 确保用上了平台可用的 _snowboydetect.so 包。建议自行编译一个。

jack server is not running or cannot be started

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 934
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 934
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 934
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory

答:不影响功能,只是pulseaudio的告警,可以忽略。

No such file or directory: 'play'

Exception in thread Thread-6:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/Users/FanXingGuo/Downloads/wukong-robot-master/robot/Player.py", line 81, in run
self.pipe = subprocess.Popen(cmd, stdout=f, stderr=f)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in **init**
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'play'

答:你需要先安装 sox 。参见 安装教程

离线唤醒机制初始化失败:[Errno -9996] Invalid input device (no default output device)

答:启动了多个 wukong-robot 了。请参见 退出 ,kill 掉所有后台的 wukong 进程。

使用问题

播放音乐没有声音

播放音乐的时候,没有声音。

答:你需要安装 mp3 的 sox 解码库:

sudo apt-get install libsox-fmt-all

语音卡着播放不出来

有 Respeaker 用户遇到语音卡着没有播出来的问题(例如 issue #94、#113),问题可能为 alsa 和 pulseaudio 冲突导致。

解决办法:

  1. 备份 /etc/pulse/default.pa 文件:

    sudo cp /etc/pulse/default.pa /etc/pulse/default_backup.pa
  2. 编辑 /etc/pulse/default.pa 文件:

    ### Load audio drivers statically
    ### (it's probably better to not load these drivers manually, but instead
    ### use module-udev-detect -- see below -- for doing this automatically)
    #load-module module-alsa-sink
    #load-module module-alsa-source device=hw:1,0
    #load-module module-oss device="/dev/dsp" sink_name=output source_name=input
    #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
    #load-module module-null-sink
    #load-module module-pipe-sink
    

    找到这一段,改为:

    ### Load audio drivers statically
    ### (it's probably better to not load these drivers manually, but instead
    ### use module-udev-detect -- see below -- for doing this automatically)
    load-module module-alsa-sink device=dmixed
    load-module module-alsa-source device=dsnoop
    #load-module module-oss device="/dev/dsp" sink_name=output source_name=input
    #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
    load-module module-null-sink
    load-module module-pipe-sink
    

    再找到这一段:

    ### Automatically load driver modules depending on the hardware available
    .ifexists module-udev-detect.so
    load-module module-udev-detect
    .else
    ### Use the static hardware detection module (for systems that lack udev support)
    load-module module-detect
    .endif
    

    注释掉第3行,第6行:

    ### Automatically load driver modules depending on the hardware available
    .ifexists module-udev-detect.so
    #load-module module-udev-detect
    .else
    ### Use the static hardware detection module (for systems that lack udev support)
    #load-module module-detect
    .endif
    

XXX not specified in profile

使用过程中遇到如下的警告:

statistic not specified in profile, defaulting to 'True'

随着 wukong-robot 的版本迭代,难免会新增加一些配置项。而用户自己的配置项已经是写到一个本地的文件,更新程序是无法直接获取和修改用户的本地配置的。所以为了做好向下兼容,对一些新增的配置项,一般都会取一个默认值。但毕竟是缺了这个配置,所以 wukong-robot 会发出这个警告。

解决办法是在配置文件(~/.wukong/config.yml)中增加这个配置以消除警告即可。例如针对 statistic 配置项:

statistic: True