Since smart speakers like a google home or amazon alexa become popular, I try the Respeaker, which is smart speaker we can DIY. We can buy it from Seedstudio, and in my case, the product are delivered about 1 week from order.
The reason why I bought only mic array is I am interested in multi channel audio recording. Also, software which included in Respeaker Core are almost all open-source, and we can use it in a computer like a Raspberry Pi through USB cable.
So, I start to play some software from official github.
First, I install respeaker_python_library to Raspberry Pi3 and play it. My environments are below.
$ uname -a Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux $ python -V Python 2.7.9
Basically, I follow the README.md in repository, however, I need to install additional dependencies.
Install dependencies software
Install the libraries by using
pip. Also, to use
pyaudio, I download, build, and install portaudio.
$ sudo apt install swig python-dev libpulse-dev $ sudo pip install pocketsphinx webrtcvad
Build & install portaudio
$ wget http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz $ tar -xvzf ./pa_stable_v190600_20161030.tgz $ cd portaudio $ ./configure $ make $ sudo make install
Install pyaudio, pyusb
$ sudo pip install pyaudio pyusb
Everything is ready, then run. Note that we can install this library by
sudo pip install respeaker, but I clone to the working directory.
$ git clone https://github.com/respeaker/respeaker_python_library.git $ cd respeaker_python_library $ cd examples $ sudo python ./offline_voice_assistant.py
In initial state, the program react to words: “respeaker”, “alexa” and “play music”.
We can find this configuration in
Next, I try this repository, which is utilities for Respeaker Microphone Array. From README, this repository provides codes like DOA(Direction of Arrival), VAD(VoiceActivity Detection), KWS(Keyword Spotting or Keyword Search).
And from Requirements, I need to change the firmware of mic array to get the 8ch raw audio.
Change the firmware
Therefore, I use this and update the firmware by the following commands.
$ sudo apt install libusb-1.0-0-dev $ git clone https://github.com/respeaker/mic_array_dfu.git $ cd mic_array_dfu/ $ make $ sudo ./dfu --download respeaker_mic_array_8ch_raw.bin
After finishing, I cloned repository and run programs by following instructions in Readme. Because dependent libraries are already installed, I did not need to install additional libraries.
$ git clone https://github.com/respeaker/mic_array.git $ sudo python pixel_ling.py
Record 8ch audio by using arecord
Finally, I record 8ch audio by using arecord. First, if you did not update the firmware mentioned above, you need to do it. Then, configure a mic array device in host computer.
$ arecord --list-devices card 1: Array [Respeaker Microphone Array], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
In this case, because card is 1 and device is 0, I can record by the following command.
# record by 32k, 8ch $ arecord -v -D hw:1,0 -f S16_LE -r 32000 -c 8 audio-8ch-32k.wav
You can confirm the audio waves by a software like a audacity, and you can see there are some differences between channels.
- Easily done audio recognition or record. You can make your own smart speaker by Respeaker.
- Why 8ch recording despite the number of mic is 7 ???