Respeaker 4 mic hat instructions do not work

Applications/questions using Raspberry Pi with Seeed products, please post it here.

Moderators: lily.li, violet, salmanfarisvp

Post Reply
thomas.wright1
Pre-kindergarten
Pre-kindergarten
Posts: 1
Joined: Wed May 15, 2019 3:41 pm

Respeaker 4 mic hat instructions do not work

Post by thomas.wright1 » Wed May 15, 2019 3:44 pm

Hi all,

I have the respeaker 4 hat on a raspberry pi 3b+ with the newest raspbian image (2019-08-04) - started from the clean image.

I have carefully followed the instruction on Seeeds forum page (as linked from the the product page). I have the leds workings with pixels_demo.py, and can record with arecord and play back with aplay.

However kws_doa.py does not work (from the 4mics_hat library)

(env) pi@pistt:~/4mics_hat $ python kws_doa.py
[‘arecord’, ‘-t’, ‘raw’, ‘-f’, ‘S16_LE’, ‘-c’, ‘4’, ‘-r’, ‘16000’, ‘-D’, ‘default’, ‘-q’]
arecord: main:788: audio open error: No such file or directory

I have tried other options but nothing seems capable of listening to the 4 mic hat for input correctly for speech recognition.

Typing arecord -L yields (not the same as on the wiki for this device i.e. no default)

(env) pi@pistt:~/4mics_hat $ arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
playback
ac108
default
sysdefault:CARD=seeed4micvoicec
seeed-4mic-voicecard,
Default Audio Device
dmix:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample mixing device
dsnoop:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample snooping device
hw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct hardware device without any conversions
plughw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Hardware device with all software conversions

Is there something wrong with the setup?

thanks

bill.yu
Junior-7
Junior-7
Posts: 735
Joined: Mon Apr 02, 2018 11:05 am

Re: Respeaker 4 mic hat instructions do not work

Post by bill.yu » Thu May 16, 2019 5:16 pm

Hi there

Follow the wiki page and get the DOA work with key words snowboy, you have to say **snowboy** to get DOA. You can see below logs.If you still can not get it work, you can download our full build image from below link. thanks.

https://v2.fangcloud.com/share/7395fd13 ... ario=share

Code: Select all

pi@raspberrypi:~ $ cd /home/pi
pi@raspberrypi:~ $  git clone https://github.com/respeaker/4mics_hat.git
Cloning into '4mics_hat'...
remote: Enumerating objects: 31, done.
remote: Total 31 (delta 0), reused 0 (delta 0), pack-reused 31
Unpacking objects: 100% (31/31), done.
pi@raspberrypi:~ $ cd /home/pi/4mics_hat
pi@raspberrypi:~/4mics_hat $ sudo apt install python-virtualenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  python3-virtualenv virtualenv
The following NEW packages will be installed:
  python-virtualenv python3-virtualenv virtualenv
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 138 kB of archives.
After this operation, 316 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf python-virtualenv all 15.1.0+ds-1 [61.1 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf python3-virtualenv all 15.1.0+ds-1 [57.7 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf virtualenv all 15.1.0+ds-1 [19.7 kB]
Fetched 138 kB in 17s (7,775 B/s)
Selecting previously unselected package python-virtualenv.
(Reading database ... 139797 files and directories currently installed.)
Preparing to unpack .../python-virtualenv_15.1.0+ds-1_all.deb ...
Unpacking python-virtualenv (15.1.0+ds-1) ...
Selecting previously unselected package python3-virtualenv.
Preparing to unpack .../python3-virtualenv_15.1.0+ds-1_all.deb ...
Unpacking python3-virtualenv (15.1.0+ds-1) ...
Selecting previously unselected package virtualenv.
Preparing to unpack .../virtualenv_15.1.0+ds-1_all.deb ...
Unpacking virtualenv (15.1.0+ds-1) ...
Setting up python3-virtualenv (15.1.0+ds-1) ...
Setting up python-virtualenv (15.1.0+ds-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up virtualenv (15.1.0+ds-1) ...
pi@raspberrypi:~/4mics_hat $ virtualenv --system-site-packages ~/env
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/pi/env/bin/python2
Also creating executable in /home/pi/env/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
pi@raspberrypi:~/4mics_hat $ source ~/env/bin/activate
(env) pi@raspberrypi:~/4mics_hat $ pip install spidev gpiozero
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: spidev in /usr/local/lib/python2.7/dist-packages (3.2)
Requirement already satisfied: gpiozero in /usr/lib/python2.7/dist-packages (1.4.1)
(env) pi@raspberrypi:~/4mics_hat $ python pixels_demo.py
^C(env) pi@raspberrypi:~/4mics_hat $ sudo apt install libatlas-base-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libatlas-base-dev is already the newest version (3.10.3-1+rpi1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
(env) pi@raspberrypi:~/4mics_hat $ sudo apt install python-pyaudio
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pyaudio is already the newest version (0.2.11-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
(env) pi@raspberrypi:~/4mics_hat $ pip install ./snowboy*.whl
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./snowboy-1.2.0b1-py2-none-any.whl
Requirement already satisfied: PyAudio in /usr/lib/python2.7/dist-packages (from snowboy==1.2.0b1) (0.2.11)
Installing collected packages: snowboy
  Found existing installation: snowboy 1.3.0
    Not uninstalling snowboy at /usr/local/lib/python2.7/dist-packages, outside environment /home/pi/env
    Can't uninstall 'snowboy'. No files were found to uninstall.
Successfully installed snowboy-1.2.0b1
(env) pi@raspberrypi:~/4mics_hat $ pip install ./webrtc*.whl
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./webrtc_audio_processing-0.0.1-cp27-cp27mu-linux_armv7l.whl
Installing collected packages: webrtc-audio-processing
  Found existing installation: webrtc-audio-processing 0.1.3
    Not uninstalling webrtc-audio-processing at /usr/local/lib/python2.7/dist-packages, outside environment /home/pi/env
    Can't uninstall 'webrtc-audio-processing'. No files were found to uninstall.
Successfully installed webrtc-audio-processing-0.0.1
(env) pi@raspberrypi:~/4mics_hat $ cd ~/
(env) pi@raspberrypi:~ $ git clone https://github.com/voice-engine/voice-engine
Cloning into 'voice-engine'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 367 (delta 0), reused 1 (delta 0), pack-reused 363
Receiving objects: 100% (367/367), 470.97 KiB | 195.00 KiB/s, done.
Resolving deltas: 100% (222/222), done.
(env) pi@raspberrypi:~ $ cd voice-engine/
(env) pi@raspberrypi:~/voice-engine $ python setup.py install
running install
running bdist_egg
running egg_info
creating voice_engine.egg-info
writing voice_engine.egg-info/PKG-INFO
writing top-level names to voice_engine.egg-info/top_level.txt
writing dependency_links to voice_engine.egg-info/dependency_links.txt
writing entry points to voice_engine.egg-info/entry_points.txt
writing manifest file 'voice_engine.egg-info/SOURCES.txt'
reading manifest file 'voice_engine.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
writing manifest file 'voice_engine.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/doa_respeaker_2mic_hat.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/delay_sum.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/raw_file_source.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/ns.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/dba.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/ec.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/file_source.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/source.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/__init__.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/pyaudio_source.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/element.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/kws_snowboy.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/alsa_source.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/gcc_phat.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/doa_respeaker_6mic_array.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/route.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/thread_file_sink.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/doa_respeaker_4mic_linear_array.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/doa_respeaker_4mic_array.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/kws.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/channel_picker.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/file_sink.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/dbfs.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/raw_file_sink.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/vad.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/doa_respeaker_6p1_mic_array.py -> build/lib.linux-armv7l-2.7/voice_engine
copying voice_engine/doa_respeaker_v2_6mic_array.py -> build/lib.linux-armv7l-2.7/voice_engine
creating build/bdist.linux-armv7l
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/doa_respeaker_2mic_hat.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/delay_sum.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/raw_file_source.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/ns.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/dba.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/ec.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/file_source.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/source.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/__init__.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/pyaudio_source.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/element.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/kws_snowboy.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/alsa_source.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/gcc_phat.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/doa_respeaker_6mic_array.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/route.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/thread_file_sink.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/doa_respeaker_4mic_linear_array.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/doa_respeaker_4mic_array.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/kws.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/channel_picker.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/file_sink.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/dbfs.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/raw_file_sink.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/vad.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/doa_respeaker_6p1_mic_array.py -> build/bdist.linux-armv7l/egg/voice_engine
copying build/lib.linux-armv7l-2.7/voice_engine/doa_respeaker_v2_6mic_array.py -> build/bdist.linux-armv7l/egg/voice_engine
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/doa_respeaker_2mic_hat.py to doa_respeaker_2mic_hat.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/delay_sum.py to delay_sum.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/raw_file_source.py to raw_file_source.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/ns.py to ns.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/dba.py to dba.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/ec.py to ec.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/file_source.py to file_source.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/source.py to source.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/pyaudio_source.py to pyaudio_source.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/element.py to element.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/kws_snowboy.py to kws_snowboy.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/alsa_source.py to alsa_source.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/gcc_phat.py to gcc_phat.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/doa_respeaker_6mic_array.py to doa_respeaker_6mic_array.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/route.py to route.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/thread_file_sink.py to thread_file_sink.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/doa_respeaker_4mic_linear_array.py to doa_respeaker_4mic_linear_array.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/doa_respeaker_4mic_array.py to doa_respeaker_4mic_array.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/kws.py to kws.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/channel_picker.py to channel_picker.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/file_sink.py to file_sink.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/dbfs.py to dbfs.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/raw_file_sink.py to raw_file_sink.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/vad.py to vad.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/doa_respeaker_6p1_mic_array.py to doa_respeaker_6p1_mic_array.pyc
byte-compiling build/bdist.linux-armv7l/egg/voice_engine/doa_respeaker_v2_6mic_array.py to doa_respeaker_v2_6mic_array.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying voice_engine.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying voice_engine.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying voice_engine.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying voice_engine.egg-info/entry_points.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying voice_engine.egg-info/not-zip-safe -> build/bdist.linux-armv7l/egg/EGG-INFO
copying voice_engine.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
creating dist
creating 'dist/voice_engine-0.1.3-py2.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing voice_engine-0.1.3-py2.7.egg
creating /home/pi/env/lib/python2.7/site-packages/voice_engine-0.1.3-py2.7.egg
Extracting voice_engine-0.1.3-py2.7.egg to /home/pi/env/lib/python2.7/site-packages
Adding voice-engine 0.1.3 to easy-install.pth file

Installed /home/pi/env/lib/python2.7/site-packages/voice_engine-0.1.3-py2.7.egg
Processing dependencies for voice-engine==0.1.3
Finished processing dependencies for voice-engine==0.1.3
(env) pi@raspberrypi:~/voice-engine $ cd ~/4mics_hat
(env) pi@raspberrypi:~/4mics_hat $ python kws_doa.py
['arecord', '-t', 'raw', '-f', 'S16_LE', '-c', '4', '-r', '16000', '-D', 'default', '-q']
detected 1 at direction 194.790707922
detected 1 at direction 194.790707922
detected 1 at direction 225.209292078
detected 1 at direction 135.209292078
^C(env) pi@raspberrypi:~/4mics_hat $

(env) pi@raspberrypi:~/4mics_hat $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
default
playback
ac108
sysdefault:CARD=seeed4micvoicec
    seeed-4mic-voicecard,
    Default Audio Device
dmix:CARD=seeed4micvoicec,DEV=0
    seeed-4mic-voicecard,
    Direct sample mixing device
dsnoop:CARD=seeed4micvoicec,DEV=0
    seeed-4mic-voicecard,
    Direct sample snooping device
hw:CARD=seeed4micvoicec,DEV=0
    seeed-4mic-voicecard,
    Direct hardware device without any conversions
plughw:CARD=seeed4micvoicec,DEV=0
    seeed-4mic-voicecard,
    Hardware device with all software conversions


Post Reply