Difference between revisions of "Template:SelectAudio"
From FriendlyELEC WiKi
(→选择系统默认音频设备) |
(→Set Audio Device) |
||
Line 8: | Line 8: | ||
$ apt-get install alsa-utils | $ apt-get install alsa-utils | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * | + | * After installation is done you can list all the audio devices by running the following command. Here is a similar list you may see after you run the command: |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ aplay -l | $ aplay -l | ||
Line 15: | Line 15: | ||
card 2: I2S codec | card 2: I2S codec | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | "card 0" is HDMI-Audio, "card 1" is 3.5mm audio jack and "card 2" is I2S-Codec. You can set default audio device to HDMI-Audio by changing the "/etc/asound.conf" file as follows: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
pcm.!default { | pcm.!default { | ||
Line 28: | Line 28: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | If you change "card 0" to "card 1" the 3.5mm audio jack will be set to the default device.<br> | |
− | + | Copy a .wav file to your board and test it by running the following command: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ aplay /root/Music/test.wav | $ aplay /root/Music/test.wav | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | You will hear sounds from system's default audio device. |
Revision as of 07:26, 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
- After installation is done you can list all the audio devices by running the following command. Here is a similar list you may see after you run the command:
$ aplay -l card 0: HDMI card 1: 3.5mm codec card 2: I2S codec
"card 0" is HDMI-Audio, "card 1" is 3.5mm audio jack and "card 2" is I2S-Codec. You can set default audio device to HDMI-Audio by changing the "/etc/asound.conf" file as follows:
pcm.!default { type hw card 0 device 0 } ctl.!default { type hw card 0 }
If you change "card 0" to "card 1" the 3.5mm audio jack will be set to the default device.
Copy a .wav file to your board and test it by running the following command:
$ aplay /root/Music/test.wav
You will hear sounds from system's default audio device.