Difference between revisions of "Template:SelectAudio"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(选择系统默认音频设备)
Line 1: Line 1:
===选择系统默认音频设备===
+
===Set Audio Device===
如果当前系统存在多个音频设备, 例如HDMI-Audio、3.5mm耳机座、I2S-Codec时, 可以通过下列操作设置系统默认使用的音频设备。
+
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.
* 启动板子后,执行以下步骤安装alsa包:
+
* After your board is booted run the following commands to install alsa packages:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ apt-get update
 
$ apt-get update

Revision as of 07:19, 13 April 2018

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

可以听见从系统默认的音频设备里输出音频。