Introduction to Sound Card Resources
1. Introduction to Sound Card ResourcesThe EASY-EAI-Nano-TB is equipped with only one sound card output by the RV1126B main control chip.
You can access the development board terminal via serial port debugging or SSH, then execute the aplay command to view detailed sound card information as follows:
aplay -lThe location of the hardware interface is shown in the figure below.
Linux systems typically use the ALSA (Advanced Linux Sound Architecture) framework (including aplay, arecord, amixer commands) to call sound card functions at the application layer. This document only covers parts relevant to this development board platform. For a deeper understanding of ALSA usage, refer to Introduction to《ALSA Usage》in the developer community.
Audio playback is performed using the aplay command:
aplay -D plughw:0,0 test.wav ##声音从Card0输出2.2 Volume AdjustmentThe valid range for the output volume value of Card0 is 0 to 510:
amixer -c 0 cset name='DAC Digital Volume' 0,0 ##设置Card0输出音量【值】为 0
amixer -c 0 cset name='DAC Digital Volume' 192,192 ##设置Card0输出音量【值】为 192
amixer -c 0 cset name='DAC Digital Volume' 255,255 ##设置Card0输出音量【值】为 255Note:
- The "value" here is a variable positively correlated with gain, but it is neither gain nor a volume percentage.
Adjusting this value results in non-linear changes in volume level.
- 0~255: Digital gain range. Setting it to 255 achieves the maximum undistorted volume.
- 256~510: Analog gain range. Any value exceeding 255 will cause audio distortion.
- Adjusting this value results in non-linear changes in volume level.0~255: Digital gain range. Setting it to 255 achieves the maximum undistorted volume.256~510: Analog gain range. Any value exceeding 255 will cause audio distortion.
The I2S/SAI controller used at the hardware level does not support mono audio, audio mixing, and other scenarios. However, users can perform data conversion via alsa-plug by modifying the ~/.asoundrc file.
Since the I2S/SAI controller does not support mono audio, playing mono audio files directly will result in a "double-speed playback" issue. To resolve this, modify the ~/.asoundrc file for channel conversion by adding the following content:
pcm.!default
{
type asym
playback.pcm "playbackmono"
capture.pcm "hw:0,0"
}
pcm.playbackmono {
type route
slave.pcm "hw:0,0" # 输出到声卡设备hw:0,0
slave.channels 2
ttable { #配置通道route,
0.0 0.5
0.1 0.5
1.0 0.5
1.1 0.5
}
}Then use one of the following commands to play mono audio files:
aplay -D default test_mono.wavor
aplay -D playbackmono test_mono.wav

Comments