Skip to content

树莓派声卡问题大全

Junjie Wang edited this page Nov 11, 2017 · 1 revision

1. How to record and play on Linux devices?

arecord -r 16000 -f S16_LE -t wav -d 3 temp.wav
aplay temp.wav

2. 为 PocketSphinx 设置树莓派声卡

cat /proc/asound/cards

check your microphone is visible or not and if on which usb extension

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

Now change this

Keep snd-usb-audio from being loaded as first soundcard 
options snd-usb-audio index=-2

To

Keep snd-usb-audio from being loaded as first soundcard 
options snd-usb-audio index=0

20171105:修改为0以后可以用PocketSphinx。

if there is some other options snd-usb-audio index=1 , make it as comment

sudo reboot 
cat /proc/asound/cards 

check your device is at 0

sudo apt-get install bison
sudo apt-get install libasound2-dev

download sphinxbase latest , extract

./configure --enable-fixed
make
sudo make install

download pocketsphinx, extract

./configure
make
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib 
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

go to src/programs/

pocketsphinx_continuous -samprate 16000/8000/48000

Cheers :)