3.5mm Audio Jack
1. Introduction
The RK3506B connects to an external audio codec, the ES8311, via I2S and I2C interfaces to enable audio recording and playback. It supports microphone input and headphone output, meeting the requirements for high-quality audio processing.
2. Audio Configuration
Check available sound card devices
root@luckfox:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: rockchipes8311s [rockchip,es8311-sound], device 0: ff310000.sai-ES8311 HiFi ES8311 HiFi-0 [ff310000.sai-ES8311 HiFi ES8311 HiFi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
root@luckfox:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: rockchipes8311s [rockchip,es8311-sound], device 0: ff310000.sai-ES8311 HiFi ES8311 HiFi-0 [ff310000.sai-ES8311 HiFi ES8311 HiFi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0- card0: Refers to the ES8311 audio codec.
Driver nodes for the sound card
root@luckfox:~# ls /dev/snd/
by-path controlC0 pcmC0D0c pcmC0D0p timer- controlC0: Used for sound card control, where C0 refers to card 0, corresponding to the ES8311 audio output mentioned above.
- pcmC0D0c: The pcm device used for recording. The c stands for capture.
- pcmC0D0p: The pcm device used for playback. The p stands for playback.
- by-path: Stores device mapping information.
root@luckfox:~# ls -l /dev/snd/by-path/
total 0
lrwxrwxrwx 1 root root 12 Jan 1 00:00 platform-es8311-sound -> ../controlC0
3. Recording
Record audio in WAV format at 16kHz sampling rate, 2 channels, 16-bit:
arecord -D hw:0,0 -t wav -d 10 -f S16_LE test.wav- -f S16_LE: Specifies 16-bit little-endian PCM format
- -r 16000: Sets the sample rate to 16 kHz
- -D hw:0,0: Selects card 0, device 0
- -d 10: Duration of recording in seconds
- test.wav: Output filename
If no sample rate is specified, arecord defaults to 44100 Hz (CD quality).
arecord -f cd -Dhw:0 -d 30 test.wav
4. Playback
Play audio in WAV format:
aplay test.wav
5. Volume Adjustment
Adjust headphone volume (recommended)
amixer -c 0 sset 'DAC VOLUME' 50%- Recommended range: 40%–70%
amixer -c 0 cset name='DAC VOLUME' 150- Recommended range: 100–180
Adjust volume using SoX
# Check the maximum volume adjustment factor
# sox anheqiao.wav -n stat
Samples read: 22058820
Length (seconds): 250.100000
Scaled by: 2147483647.0
Maximum amplitude: 0.891235
Minimum amplitude: -0.891266
Midline amplitude: -0.000015
Mean norm: 0.153542
Mean amplitude: -0.000068
RMS amplitude: 0.206771
Maximum delta: 1.232666
Minimum delta: 0.000000
Mean delta: 0.060496
RMS delta: 0.092891
Rough frequency: 3153
Volume adjustment: 1.122
## Adjust volume by applying a scaling factor, creating a new file
sox -v 0.2 anheqiao.wav output.wav- SoX (Sound eXchange) is a powerful audio processing tool. Note that some features, such as MP3 encoding, may require specific build options or external libraries.