audio-loopback
PDM microphone in → I²S speaker out. Demonstrates the audio capture-and-playback path from <alp/audio.h>.
Source: examples/audio-loopback/.
board.yaml
schema_version: 2
som:
sku: E1M-AEN701
carrier:
name: E1M-EVK
cores:
m55_hp:
os: zephyr
app: ./src
peripherals: [i2s]
diagnostics:
log_level: info
PDM RX support (CONFIG_AUDIO_DMIC=y) lives under Zephyr's audio subsystem rather than as a standalone peripherals: entry — testcase.yaml's extra args wire it on. The application code uses the unified <alp/audio.h> surface.
Source (abbreviated)
#include <alp/audio.h>
int main(void) {
alp_audio_in_t *mic = alp_audio_in_open(&(alp_audio_in_config_t){
.sample_rate_hz = 16000, .channels = 1, .bit_depth = 16,
});
alp_audio_out_t *spk = alp_audio_out_open(&(alp_audio_out_config_t){
.sample_rate_hz = 16000, .channels = 1, .bit_depth = 16,
});
if (mic == NULL || spk == NULL) return -1;
int16_t buf[256];
while (1) {
size_t got;
alp_audio_in_read(mic, buf, ARRAY_SIZE(buf), &got);
alp_audio_out_write(spk, buf, got);
}
}
See also
<alp/audio.h>referencei2s-tone— pure I²S output- Examples overview
Questions about this page? Discuss in Community Forum