[PYTHON] Use raspberryPi and julius (speech recognition). ① Microphone edition

Related article

Use raspberryPi and julus (speech recognition). ① Microphone Use julius (speech recognition) on raspberry Pi. ② Installation Use raspberry Pi and Julius (speech recognition). ③ Dictionary creation Use raspberry Pi and Julius (speech recognition). ④ L Chika Use raspberry Pi and Julius (speech recognition). ⑤ i2c character display

What to use Raspberry Pi 3 Model B+ USB microphone (Sanwa Supply USB microphone unidirectional direct insertion type MM-MCU02BK)

Microphone settings

Connect the microphone to the Raspberry Pi's USB port and make sure the microphone is recognized.

$lsusb

image.png

You can see that the top C-Media is recognized by the microphone.

Raise the priority of the microphone Check the priority of the audio module.
$ cat /proc/asound/modules
 0 snd_bcm2835
 1 snd_usb_audio

At first, 0 is the built-in audio module and 1 is the USB microphone, so rewrite the priority.

$ sudo nano /etc/modprobe.d/alsa-base.conf

Write the following code in the editor that opens.

options snd slots=snd_audio,snd_bcm2835
options snd_usb_audio index=0
options snd_bcm2835 index=1

image.png Exit with ctrl + X and reboot.

$ reboot

After starting up, check the priority again, and if 0 is the USB audio module and 1 is the built-in audio module, it is successful.

$lsusb

image.png

Sound driver installation Install aptitude and then the ALSA sound driver. It seems that the raspberryPi3B + does not include the snd-pcm-oss module.
sudo apt-get install aptitude
sudo apt-get install osspd-alsa
sudo aptitude install libasound2-dev

Check the sound card number of the microphone.

$ arecord -l

image.png Set environment variables so that you can always use the same settings.

$ sudo nano ~/.profile

Add the following code at the top or bottom of the opened editor, where it doesn't interfere with the code you're writing.

export ALSADEV=hw:0,0

Exit with ctrl + X and reboot.

$ reboot

Microphone setting is complete Next to Julius installation [Use julius (speech recognition) on raspberry Pi. ② Installation](https://qiita.com/chiapis2/items/7ec1b0b21ee4fef4e8f0)

Reference [Memorandum until julius can be operated with Raspberry pi 3B + (as of March 10, 2019)](https://qiita.com/todateman/items/9c0e291e7b378a3c559b) [Raspberry Pi Day 2: Connect a microphone to the Raspberry Pi](https://kihara0223.hatenablog.com/entry/2020/01/02/140738)

Recommended Posts

Use raspberryPi and julius (speech recognition). ① Microphone edition
Use raspberryPi and Julius (speech recognition). ④ L Chika
Use raspberryPi and Julius (speech recognition). ⑤ i2c character display
Use julius (speech recognition) on raspberryPi. ② Installation
Use raspberry Pi and Julius (speech recognition). ③ Dictionary creation
Speech synthesis and speech recognition by Microsoft Project Oxford