Microphone Setup - snipsco/snipsmanager GitHub Wiki
Copy the following configuration to /etc/asound.conf
:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
If using a Snipsfile, this configuration will be automatically generated on your behalf.
The ReSpeaker 7-Mic Array is a microphone array designed for prototyping. It features an XMOS XVSM-2000 DSP chip, providing excellent performance for ASR and wakework detection even in a noisy setting.
It has a small, convenient size factor, and as a bonus, it features a led ring. Furthermore, both microphone and leds can be accessed with a single USB cable, rather than through GPIO ports. This allows for more versatile configurations, and reduces the amount of space required.
First, obtain the device vendor ID and product ID using the lsusb
command:
$ lsusb
Bus 001 Device 005: ID 2886:0007
...
The last two colon-separated numbers, 2886
and 0007
correspond to the vendor and product IDs.
Then add the following section to your Snipsfile:
microphone:
identifier: respeaker
params:
vendor_id: <VENDOR_ID>
product_id: <PRODUCT_ID>
replacing <VENDOR_ID>
and <PRODUCT_ID>
with the appropriate values. Now run:
$ sudo snipsmanager install
and your ReSpeaker microphone and leds will be ready to use.
First, check that the ReSpeaker is correctly detected as a recording device:
$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Array [ReSpeaker Microphone Array], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
In this example, the ReSpeaker is identified as card 1 and device 0.
To tell Snips to use this device for recording, edit your /etc/asound.conf
file, or create it if it does not exist, and add or modify the capture.pcm
section:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type dsnoop
ipc_key 5432
slave {
pcm "hw:1,0"
buffer_size 96000
}
}
}
Note: the playback.pcm
is shown here for convenience as it corresponds to using the default Raspberry Pi jack output for audio playback. If your setup is different, this section may also be.
The important part is hw:1,0
. Change this to match your card and device IDs respectively, if they differ in the above output for aplay
and arecord
.
The ReSpeaker leds requires libusb
which allows you to fully manipulate the leds over USB.
First, obtain the device vendor ID and product ID using the lsusb
command:
$ lsusb
Bus 001 Device 005: ID 2886:0007
...
The last two colon-separated numbers, 2886
and 0007
correspond to the vendor and product IDs.
Now, add the following line to /lib/udev/rules.d/50-rspk.rules
(requires root privileges):
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="VENDOR_ID", ATTRS{idProduct}=="PRODUCT_ID", MODE="660", GROUP="plugdev"
making sure to replace VENDOR_ID
and PRODUCT_ID
with the values provided by the above lsusb
command.
Now, add the username pi
to the plugdev
group:
$ sudo adduser pi plugdev
Next, force the udev
system to see the changes:
$ sudo udevadm control --reload
$ sudo udevadm trigger
Finally, reboot the device, and you are all set.
The Jabra Speak Series are excellent microphone arrays. They are USB powered, and work out of the box. They also feature a good integrated speaker. To use it, you must declare the Jabra as your default speaker in your Alsa configuration.
If you only wish to use the Jabra as a microphone, and leave the Raspberry Pi's default jack for audio output, you do not need to do anything. If you wish to use the Jabra as a speaker, you need to update your Alsa configuration. This can be done simply by editing your /etc/asound.conf
file, or automatically using Sam.
Simply add the following section to your Snipsfile:
microphone:
identifier: jabra
Now run:
$ sudo snipsmanager install
and your Jabra microphone and speaker will be ready to use.
First, check that the Jabra is correctly detected as a playback and recording device:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
...
card 1: J710 [Jabra Speak 710], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: J710 [Jabra Speak 710], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
In this example, the Jabra is identified as card 1 and device 0.
To tell Snips to use this device for both playback and recording, edit your /etc/asound.conf
file, or create it if it does not exist, and paste the following:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:1,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
The important part is hw:1,0
. Change this to match your card and device IDs respectively, if they differ in the above output for aplay
and arecord
.