Audio Test
RK Linux System Audio Function Testing¶
View Sound Cards¶
cat /proc/asound/cards # List all sound cards
aplay -l # List playback devices
arecord -l # List recording devices
Tip
Taking K7 as an example: card 0 = ES8388 Codec (headphones/speaker/microphone) · card 1 = DP · card 2 = HDMI
Speaker Test¶
aplay -D hw:0,0 /etc/sample-15s.wav # Play test audio
amixer -c 0 cset name='Speaker Switch' 1 # on=on off=off
amixer -c 0 cset name='OUT1 Switch' 1 # on=on off=off
amixer -c 0 cset name='OUT2 Switch' 1 # on=on off=off
amixer -c 0 cset name='Left Mixer Left Playback Switch' 1 # on=on off=off
amixer -c 0 cset name='Right Mixer Right Playback Switch' 1 # on=on off=off
amixer -c 0 cset name='PCM Volume' 80% # Master volume 0‑100%
Headphone Test¶
aplay -D hw:0,0 /etc/sample-15s.wav # Play test audio
amixer -c 0 cset name='Headphone Switch' 1 # on=on off=off
amixer -c 0 cset name='hp switch' 1 # on=on off=off
HDMI Audio¶
Microphone Recording¶
amixer -c 0 cset name='Capture Digital Volume' 192 # Digital gain 0‑192
amixer -c 0 cset name='Capture Mute' 0 # 0=on 1=mute
amixer -c 0 cset name='Left Channel Capture Volume' 6 # Left gain 0‑8 (3dB/step)
amixer -c 0 cset name='Right Channel Capture Volume' 6 # Right gain 0‑8 (3dB/step)
amixer -c 0 cset name='Left PGA Mux' 2 # 0=Line1 single‑ended 1=Line2 single‑ended 2=Differential
amixer -c 0 cset name='Right PGA Mux' 2 # 0=Line1 single‑ended 1=Line2 single‑ended 2=Differential
amixer -c 0 cset name='Differential Mux' 1 # 0=Line1 differential pair 1=Line2 differential pair
arecord -D hw:0,0 -r 48000 -f S16_LE -d 5 -c 2 /tmp/record.wav # Record for 5 seconds
aplay -D hw:0,0 /tmp/record.wav # Playback the recording
If the volume is too low, enable ALC automatic gain:
amixer -c 0 sset 'ALC Capture Function' Stereo
amixer -c 0 sset 'ALC Capture Target Volume' 11 # Target level 0‑15
AW Linux System Audio Function Testing¶
View Sound Cards¶
Current measured results: card 0 = audiocodec (headphones) · card 1 = ahubhdmi (HDMI) · card 2 = Y1076 (USB sound card)
Headphone Test¶
Ubuntu
aplay -D hw:0,0 /etc/sample-15s.wav # Play test audio
amixer -c 0 sset LINEOUT on # on=on off=off, line‑out master switch
amixer -c 0 sset 'LINEOUTL src LR' On # Off=off On=on, left DAC‑>LINEOUT routing
amixer -c 0 sset 'LINEOUTR src LR' On # Off=off On=on, right DAC‑>LINEOUT routing
# --- Mixer switches (on by default, just verify) ---
amixer -c 0 sset 'OutputL Mixer DACL' on
amixer -c 0 sset 'OutputL Mixer DACR' on
amixer -c 0 sset 'OutputR Mixer DACL' on
amixer -c 0 sset 'OutputR Mixer DACR' on
amixer -c 0 sset 'digital volume' 57 # Digital volume 0‑63
amixer -c 0 sset 'lineout volume' 28 # Line‑out volume 0‑31
Armbian
aplay -D hw:0,0 /etc/sample-15s.wav # Play test audio
amixer -c 0 sset 'LINEOUT volume' 31 # Set volume 0‑31
HDMI Audio¶
USB Audio Devices¶
View device information: The sound card number is not fixed; it changes after re‑plugging the USB device.
cat /proc/asound/Y1076/stream0 # View playback/recording parameters
amixer -c 2 scontrols # List mixer controls
USB devices have fixed formats (playback only 48kHz stereo, recording only 16kHz mono). Use plughw to automatically convert sample rate / channel count.
Speaker Playback¶
aplay -D plughw:2,0 /etc/sample-15s.wav # Playback with plughw handling format conversion
amixer -c 2 sset PCM 147 # PCM volume 0‑147
Microphone Recording¶
amixer -c 2 sset Mic 147 # Recording gain 0‑147
amixer -c 2 sset 'Auto Gain Control' on # AGC (auto‑amplify when quiet)
arecord -D hw:2,0 -r 16000 -f S16_LE -d 5 -c 1 /tmp/usb_mic.wav # -r sample rate -f format -d duration(s) -c channels
amixer -c 2 sset PCM 147 # Set playback volume to maximum
aplay -D plughw:2,0 /tmp/usb_mic.wav
Generic PulseAudio Testing¶
Applicable to all Linux distributions with PulseAudio pre‑installed (Ubuntu / Debian / Armbian), regardless of chip platform or codec model. The following commands assume root user.
Note
Allwinner platforms (H618/A523/A733/T527 etc.) usually have PulseAudio pre‑installed and enabled by default on Ubuntu. For Rockchip platforms (RK3562~RK3588), some images require an initial configuration step as described below.
Initial Configuration (only needed if PulseAudio is not running)¶
# Allow root to access PulseAudio
usermod -a -G pulse-access root
# Set environment variable (add to /etc/environment to make permanent)
echo 'PULSE_RUNTIME_PATH=/var/run/pulse' >> /etc/environment
export PULSE_RUNTIME_PATH=/var/run/pulse
# Start PulseAudio in system mode
pulseaudio --system -D
List Output Devices¶
Common output mapping:
| Platform | Speaker/Headphone (codec) | HDMI |
|---|---|---|
| RK (ES8388) | es8388-sound |
hdmi-sound / dp0-sound |
| RK (rk809/rk817) | rk809-sound |
hdmi-sound |
| AW (H618/A523 etc.) | codec_mach |
ahub1_mach |
Note
The first column in pactl list sinks short is the sink index, the second is the device name. Choose the one corresponding to the codec for speaker/headphone.
Playback Test¶
# Replace <N> with the sink index of the speaker/headphone codec
pactl set-sink-volume <N> 100% # Volume 0‑100%, can exceed (e.g., 150%)
paplay /etc/sample-15s.wav # Play test audio
Example for K2B (Allwinner H618, headphones connected to codec_mach = sink 1):
Example for K7 (RK3576 + ES8388, sink 0):
Example for K1mini (RK3568 + rk809, sink 1):
Volume Control¶
pactl set-sink-volume <N> 80% # Set to 80%
pactl set-sink-volume <N> +10% # Increase by 10%
pactl set-sink-volume <N> -10% # Decrease by 10%
pactl set-sink-volume <N> 150% # Software boost (may distort above 150%)
pactl set-sink-mute <N> toggle # Toggle mute
pactl set-default-sink <N> # Set as default output
Frequently Asked Questions¶
Q: What to do when Connection refused appears?
A: This means the current user does not have a PulseAudio session. This is common for root users – just start PulseAudio in system mode as described in the "Initial Configuration" section above.
Q: Adjusting volume has no effect?
A: Verify the sink index is correct. Check with pactl list sinks short – the speaker/headphone uses the codec sink, HDMI is a different one.
Q: Warning about XDG_RUNTIME_DIR?
A: It is harmless – you can suppress it by running unset XDG_RUNTIME_DIR.