seeed-voicecard/README.md

150 lines
5.1 KiB
Markdown
Raw Permalink Normal View History

# seeed-voicecard
2017-09-14 14:22:02 +02:00
[![Join the chat at https://gitter.im/seeed-voicecard/Lobby](https://badges.gitter.im/seeed-voicecard/Lobby.svg)](https://gitter.im/seeed-voicecard/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2017-04-27 11:28:29 +02:00
2017-09-29 04:21:47 +02:00
The drivers of [ReSpeaker Mic Hat](https://www.seeedstudio.com/ReSpeaker-2-Mics-Pi-HAT-p-2874.html) and [ReSpeaker 4 Mic Array](https://www.seeedstudio.com/ReSpeaker-4-Mic-Array-for-Raspberry-Pi-p-2941.html) for Raspberry Pi.
## ReSpeaker Mic Hat
[![](https://github.com/SeeedDocument/MIC_HATv1.0_for_raspberrypi/blob/master/img/mic_hatv1.0.png?raw=true)](https://www.seeedstudio.com/ReSpeaker-2-Mics-Pi-HAT-p-2874.html)
2017-04-27 11:28:29 +02:00
2017-09-29 04:21:47 +02:00
While the upstream wm8960 codec is not currently supported by current Pi kernel builds, upstream wm8960 has some bugs, we had fixed it. we must it build manually.
2017-09-14 14:22:02 +02:00
2017-04-27 11:28:29 +02:00
Get the seeed voice card source code.
2017-09-18 08:31:53 +02:00
```bash
2017-07-06 04:40:45 +02:00
git clone https://github.com/respeaker/seeed-voicecard
2017-04-27 11:28:29 +02:00
cd seeed-voicecard
2017-09-18 08:31:53 +02:00
#for ReSpeaker 2-mic
2017-09-14 14:22:02 +02:00
sudo ./install.sh 2mic
2017-09-29 04:21:47 +02:00
sudo reboot
2017-04-27 12:00:49 +02:00
```
2017-04-27 11:28:29 +02:00
Check that the sound card name matches the source code seeed-voicecard.
2017-09-18 08:31:53 +02:00
```bash
#for ReSpeaker 2-mic
2017-09-15 04:04:29 +02:00
pi@raspberrypi:~/seeed-voicecard $ aplay -l
2017-04-27 11:28:29 +02:00
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
2017-09-15 04:04:29 +02:00
card 1: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 []
2017-04-27 11:28:29 +02:00
Subdevices: 1/1
Subdevice #0: subdevice #0
2017-09-15 04:04:29 +02:00
pi@raspberrypi:~/seeed-voicecard $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
pi@raspberrypi:~/seeed-voicecard $
2017-09-18 08:31:53 +02:00
```
2017-09-14 14:22:02 +02:00
2017-09-29 04:26:48 +02:00
#### Next step
Go to https://github.com/respeaker/mic_hat to build voice enabled projects with Google Assistant SDK or Alexa Voice Service.
2017-09-29 04:21:47 +02:00
## ReSpeaker 4 Mic Array
[![](https://github.com/SeeedDocument/ReSpeaker-4-Mic-Array-for-Raspberry-Pi/blob/master/img/features.png?raw=true)](https://www.seeedstudio.com/ReSpeaker-4-Mic-Array-for-Raspberry-Pi-p-2941.html)
The 4 Mic Array uses ac108 which includes 4 ADCs, we also write ac108 rapberry pi linux kernel driver.
```bash
git clone https://github.com/respeaker/seeed-voicecard
cd seeed-voicecard
sudo ./install.sh 4mic
#reboot your Raspbian OS
sudo reboot
```
Check that the sound card name matches the source code seeed-voicecard.
2017-09-18 08:31:53 +02:00
```bash
#for ReSpeaker 4-mic
2017-09-14 14:22:02 +02:00
pi@raspberrypi:~ $ arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
playback
capture
dmixed
array
ac108
default:CARD=seeed4micvoicec
seeed-4mic-voicecard,
Default Audio Device
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
pi@raspberrypi:~ $
2017-04-27 11:28:29 +02:00
```
If you want to change the alsa settings, You can use `sudo alsactl --file=asound.state store` to save it.
2017-04-27 11:28:29 +02:00
Test:
2017-09-18 08:31:53 +02:00
```bash
#for ReSpeaker 2-mic
#It will capture sound an playback on hw:1
2017-04-27 11:28:29 +02:00
arecord -f cd -Dhw:1 | aplay -Dhw:1
2017-09-18 08:31:53 +02:00
```
2017-09-14 14:22:02 +02:00
2017-09-18 08:31:53 +02:00
```bash
#for ReSpeaker 4-mic
#It will capture sound on AC108 and save as a.wav
2017-09-14 14:22:02 +02:00
arecord -Dac108 -f S32_LE -r 16000 -c 4 a.wav
2017-04-27 11:28:29 +02:00
```
2017-09-27 05:18:27 +02:00
### uninstall seeed-voicecard
If you want to upgrade the driver , you need uninstall the driver first.
```
pi@raspberrypi:~/seeed-voicecard $ sudo ./uninstall.sh 4mic
delete dtoverlay=seeed-4mic-voicecard in /boot/config.txt
delete snd-soc-ac108 in /etc/modules
------------------------------------------------------
Please reboot your raspberry pi to apply all settings
Thank you!
------------------------------------------------------
pi@raspberrypi:~/seeed-voicecard $ sudo ./uninstall.sh 2mic
delete dtoverlay=seeed-2mic-voicecard in /boot/config.txt
remove seeed-2mic-voicecard.dtbo in /boot/overlays
remove snd-soc-wm8960.ko
delete snd-soc-wm8960 in /etc/modules
------------------------------------------------------
Please reboot your raspberry pi to apply all settings
Thank you!
------------------------------------------------------
```
2017-09-07 03:40:34 +02:00
### with Google Assistant
if you run the assistant but the playback is speed up considerably, try to configure alsa:
2017-09-18 08:31:53 +02:00
```bash
2017-09-07 03:40:34 +02:00
sudo cp asound.conf /etc/asound.conf
```
2017-09-07 03:45:50 +02:00
If the alsa configuration doesn't solve the issue, try to use pulseaudio. See [#4](https://github.com/respeaker/seeed-voicecard/issues/4)
2017-09-07 03:40:34 +02:00
2017-05-22 05:59:22 +02:00
Enjoy !