Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Zero/hardware/audio"

< Zero‎ | hardware
(Created page with "{{Zero_header}} {{Languages|zero/hardware/audio}} Radxa Zero > Hardware > Audio === USB Audio === Equipped with...")
 
Line 1: Line 1:
 
{{Zero_header}}
 
{{Zero_header}}
 +
 
{{Languages|zero/hardware/audio}}
 
{{Languages|zero/hardware/audio}}
  
    [[Zero | Radxa Zero]] > [[zero/hardware | Hardware]] > [[zero/hardware/audio | Audio]]
+
[[Zero | Radxa Zero]] > [[zero/hardware | Hardware]] > [[zero/hardware/audio | Audio]]
  
 
=== USB Audio ===
 
=== USB Audio ===
  
Equipped with one USB speaker device, Radxa Zero can output sound.
+
Due to space constraint, Radxa Zero does not have a 3.5mm headphone jack for audio output. To get audio output from Radxa Zero, the easiest way is to connect to a HDMI soundbar. Alternatively you can connect to a USB sound card. Or even better, a USB speaker, which has integrated USB sound card inside. In this guide we will show you how to play sound on your USB speaker using Radxa Zero.
  
Let's take playing a song as an example.
+
Please connect your hardware in following way:
  
This is the hardware connection
+
Type-A USB speaker --- Type-C to Type-A USB Hub --- Radxa Zero
  
<pre>
+
In a terminal window on Zero, we will first run <code>aplay -l</code> to check card id for our USB speaker.
Type-A USB speaker --- Type-C to Type-A USB Hub --- Radxa Zero
+
</pre>
+
 
+
Firstly use command, aplay -l, to check the audio card number. Here is card 1.
+
  
 
<pre>
 
<pre>
Line 30: Line 27:
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
card 1: CD002 [CD002], device 0: USB Audio [USB Audio]
+
'''card 1: CD002 [CD002], device 0: USB Audio [USB Audio]'''
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
 
</pre>
 
</pre>
  
Secondly create file /etc/asound.conf and add the following content.
+
Once you identify your USB speaker, edit /etc/asound.conf to set it as the default output:
  
 
<pre>
 
<pre>
Line 50: Line 47:
 
</pre>
 
</pre>
  
Finally use mplayer or aplay to play songs.
+
You can now test your speaker by playing some sound with <code>mplay</code> or <code>aplay</code>:
 +
 
 +
root@zero:/home/rock# mplay test.wav
  
<pre>
 
root@zero:/home/rock# mplay test.wav
 
</pre>
 
 
or
 
or
<pre>
 
root@zero:/home/rock# aplay -Dhw:1,0 test.wav
 
</pre>
 
 
=== Troubleshooting ===
 
  
* Post your issue on the forum: https://forum.radxa.com/c/zero
+
root@zero:/home/rock# aplay -Dhw:1,0 test.wav

Revision as of 07:12, 2 December 2021

Radxa Zero > Hardware > Audio

USB Audio

Due to space constraint, Radxa Zero does not have a 3.5mm headphone jack for audio output. To get audio output from Radxa Zero, the easiest way is to connect to a HDMI soundbar. Alternatively you can connect to a USB sound card. Or even better, a USB speaker, which has integrated USB sound card inside. In this guide we will show you how to play sound on your USB speaker using Radxa Zero.

Please connect your hardware in following way:

Type-A USB speaker --- Type-C to Type-A USB Hub --- Radxa Zero

In a terminal window on Zero, we will first run aplay -l to check card id for our USB speaker.

root@zero:/home/rock# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: RADXAZERO [RADXA-ZERO], device 0: fe.dai-link-0 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: RADXAZERO [RADXA-ZERO], device 1: fe.dai-link-1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: RADXAZERO [RADXA-ZERO], device 2: fe.dai-link-2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
'''card 1: CD002 [CD002], device 0: USB Audio [USB Audio]'''
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Once you identify your USB speaker, edit /etc/asound.conf to set it as the default output:

root@zero:/home/rock# cat /etc/asound.conf 
pcm.!default {
  type hw
  card 1
}

ctl.!default {
  type hw
  card 1
}

You can now test your speaker by playing some sound with mplay or aplay:

root@zero:/home/rock# mplay test.wav

or

root@zero:/home/rock# aplay -Dhw:1,0 test.wav