🛠 Audio sur le Dock : enregistrer au micro numérique et jouer sur le haut-parleur 3 W
Objectives
The Dock includes everything needed for audio: a 3 W speaker amplifier (for 4 Ω speakers) with a connector, an analog electret microphone, and most importantly, a 2-channel digital microphone interface (DMIC, PDM, with data on pin PB11 and clock on pin PE17) declared in the mainline device tree under the simple-audio-card sound card named "DMIC". This tutorial covers discovering ALSA on the board, recording 5 seconds from the digital microphones, playing them back on the speaker, and adjusting levels with alsamixer. This is the entry point for voice projects (the 30-pin FPC connector for the R6 6-microphone array is the next step).
Hardware
- Lichee RV Dock running a mainline image (Buildroot sipeed_lichee_rv_dock or Ubuntu 24.04 RISC-V) with ALSA (
arecord/aplayfrom the alsa-utils package) - 4 Ω 3 W speaker connected to the Dock's HP connector (the Sipeed schematic shows the onboard amplifier)
- No additional installation required if the image is complete; otherwise
apt install alsa-utils
Complete Code
# 1) Inventaire des cartes et périphériques ALSA
cat /proc/asound/cards # attendre la carte « DMIC » (simple-audio-card)
arecord -l ; aplay -l
# 2) Enregistrement 2 canaux / 16 kHz / 16 bits pendant 5 s depuis le DMIC
arecord -D hw:0,0 -c 2 -r 16000 -f S16_LE -d 5 dmic.wav
# (si « Device or resource busy » : changer de numéro de carte vu à l'étape 1)
# 3) Lecture sur le haut-parleur (ampli 3 W du Dock)
aplay -D default dmic.wav
# 4) Niveaux : mixer en mode texte
alsamixer # F6 : choisir la carte ; monter capture « DMIC » et lecture « HP »
amixer scontrols # liste les contrôles nommés
amixer -c 0 sget 'Headphone',0 # lire un niveau
# 5) Enchaînement micro -> fichier -> haut-parleur en direct (latence élevée)
arecord -D hw:0,0 -c 2 -r 16000 -f S16_LE -t raw | aplay -D default -c 2 -r 16000 -f S16_LE -
Expected Verification
/proc/asound/cards displays the DMIC card (the dmic-sound node in the Dock's device tree). After speaking loudly for 5 seconds, dmic.wav should be approximately 320 KB (2 channels × 16 kHz × 16 bits × 5 s), and aplay should play it back clearly through the 3 W speaker. On the waveform (record while monitoring arecord -V stereo), both DMIC channels should show activity. If the sound is inaudible, it is almost always because the HP level is set to minimum in alsamixer.
Common Errors
- Forgetting the amplifier: the output signal is on the codec's headphone/amplifier path; a "Headphone" level of 0 in alsamixer results in no sound even if aplay is running.
- Wrong card number:
hw:0,0assumes the DMIC is card 0; verify witharecord -land use the observed number (the vendor Tina image exposes different names). - Recording at 44.1 kHz mono "out of Raspberry Pi habit": the D1's DMIC is a stereo PDM device typically operating at 16 kHz; an incorrect format results in noise or an error.
- 8 Ω speaker or no speaker connected: the amplifier is designed for 4 Ω 3 W; without a speaker on the connector, no sound is produced (there is no integrated buzzer).
- Tina Linux does not expose the "DMIC" card with these names: these commands target mainline images.
Other tutorials for this board
- Premier boot du Lichee RV Dock avec Ubuntu 24.04 RISC-V
- LEDs du Lichee RV Dock : LED verte et RGB WS2812 pilotée par le LEDC du D1
- Wi-Fi et Bluetooth du module RTL8723DS sur le Lichee RV Dock
- GPIO, touche utilisateur ADC et PWM sur le connecteur 2×20 du Lichee RV
- Tina Linux : l'OpenWrt vendor d'Allwinner pour le Lichee RV, installation et sysconfig
- Construire une image mainline complète avec Buildroot (defconfig officiel du Dock)
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash