16 Audio
1 Audio Interface Introduction
1.1 Introduction to Audio Decoding Chip
As is well known, processors in integrated circuits can only understand binary data. To make it understand external analog signals, you need to use an ADC chip to convert analog signals to digital signals. Similarly, if the processor needs to output sound, it needs to convert digital signals to analog signals, which requires a DAC chip. With these two processes, you can achieve sound input and output functions. However, audio signals that are not further processed will definitely "hurt your ears". We also need to add DSP units, etc. Since the essence of the CODEC chip acquiring sound is sampling, the faster the sampling rate and the greater the sampling depth, the more realistic the sound. In other words, "Hi-Fi" audio.
To solve the sound problem, we also want to achieve sound effects, volume adjustment, and unified interfaces for convenient development debugging, etc... To facilitate audio development, an audio-dedicated chip integrating all the above functions was created. This is the audio codec chip, whose English name is Audio CODEC. So when we see "CODEC" in phone or computer descriptions, it generally refers to audio codec.
1.2 Introduction to RK809
The board's core board already has an RK809 audio decoding chip from Rockchip. RK809 integrates high-performance 24-bit ADC and high-performance 24-bit DAC. The recording path consists of MIC_PGA and audio ADC. The DAC converts digital signals to analog signals. The Class AB driver uses a ground-referred structure for headphone applications, with very low THD (-90dB @1KHz@-3dBFS source). At the same time, it integrates a Class D driver for speaker applications. Speakers and headphones can be used simultaneously. It integrates I2S interface for communication with the processor. Its audio processing block diagram is as follows:

RK809 Audio Decoding Chip Configuration Features
| Feature | Description |
|---|---|
| Integrated Design | RK809 integrates PMIC and audio codec functions, simplifying hardware design |
| Standard I2S Interface | Connected to main controller via I2S1_8CH, supporting high-quality digital audio transmission |
| Complete Audio Chain | Supports full audio chain: input (microphone), output (headphone/speaker) |
| Flexible Pin Configuration | Supports multiple pin multiplexing modes, adapting to different PCB layout requirements |
| Integrated Power Management | Built-in LDO provides stable 3.3V power for audio module |
| Configurable Parameters | Supports flexible configuration of volume, sample rate, clock frequency, etc. |
| Differential Input Support | Supports differential microphone input, improving audio input quality |
1.3 Introduction to I2S Bus
Both I2S and I2C were proposed by Philips. I2S is mainly used for audio data transmission between digital audio equipment, as well as for transmitting audio data between main controllers and audio CODEC chips.
I2S interface requires 3-4 signal lines:
- SCK: Serial clock signal
- WS: Channel selection signal
- SD: Serial data signal (if simultaneous recording and playback are needed, 2 signal lines are required: SDO and SDI)
2 Audio Interface Board Card Location

3 Audio Usage - Command Line Method
3.1 Audio Test Commands
Here we use the dedicated audio debugging tools provided by OpenHarmony system, idl_capture and idl_render, to test recording and playback functions.
Commands are as follows:
idl_capture xxx.wav // Record audio and save to file xxx.wav
idl_render xxx.wav // Play audio file xxx.wav3.2 Specific Demonstration of Audio Testing
First, create a test file in the /data directory:
touch data/test.wavThen execute the command idl_capture data/test.wav to start recording. The process is as follows:



Recording is complete. Now execute the playback command idl_render data/test.wav:


