Template:SelectAudio
From FriendlyELEC WiKi
Set Audio Device
If your system has multiple audio devices such as HDMI-Audio, 3.5mm audio jack and I2S-Codec you can set system's default audio device by running the following commands.
- After your board is booted run the following commands to install alsa packages:
$ apt-get update $ apt-get install libasound2 $ apt-get install alsa-base $ apt-get install alsa-utils
- 安装好需要的库后,查看系统当前所有的声卡设备的序列号。这里假设aplay的输出如下, 并不是真实情况, 请根据实际情况进行相对应的修改:
$ aplay -l card 0: HDMI card 1: 3.5mm codec card 2: I2S codec
上面的信息表示card 0代表HDMI-Audio,card 1代表3.5mm耳机座, card 2代表I2S-Codec,修改配置文件/etc/asound.conf如下表示选择HDMI-Audio:
pcm.!default { type hw card 0 device 0 } ctl.!default { type hw card 0 }
如果将card 0修改为card 1, 则表示选择3.5mm耳机座, 以此类推。
拷贝一首 .wav 格式的音乐到开发板上,播放音乐:
$ aplay /root/Music/test.wav
可以听见从系统默认的音频设备里输出音频。