若想知道USB声卡的制作过程,请看本人的另一篇博文:【基于PCM2912a的USB声卡设计】
基础条件:
raspbian系统,我用的版本是2014-12-24-wheezy-raspbian.img,其他版本没测试。
步骤:
1,将USB声卡插入树莓派,启动树莓派
2,查看USB声卡是否被系统识别
cat /proc/asound/cards
如上图,看到的设备1就是USB声卡
3,切换声卡
vim /etc/modprobe.d/alsa-base.conf
将options snd-usb-audio index=-2”改为“options snd-usb-audio index=0”,保存,退出。
4,重启树莓派
5,查看声卡是否切换成功
cat /proc/asound/cards
如上图,我们看到声卡已经切换成功。
6,放音、录音测试
6.1,安装SOX音频工具
apt-get update //更新软件源列表
apt-get install sox //安装sox
sudo apt-get install sox libsox-fmt-all //使sox支持多种音频格式
6.2,放音测试
play smallApple.mp3
play tianTang.wav
6.3,录音测试
rec test.wav
有关sox工具的多种用法,请移步到百度。