Audio Capture
PDM microphone capture with RMS/peak statistics streamed over SWO.
| Declared by the example author | Value |
|---|---|
| Tier | Capabilities |
| Status | tested |
| Capabilities | audio, pdm |
| Boards tested | apollo510_evb |
Build it from a source checkout by name, because the positional app argument resolves
under ./examples:
nsx build audio_capture --board apollo510_evbThe rest of this page is the example’s own README, from
examples/audio_capture/.
Demonstrates nsx-audio on the Apollo510 EVB. Configures the PDM microphone at 16 kHz, captures 30 ms audio frames, and prints peak amplitude to SWO every 100 frames (~3 seconds).
Build & Run
Section titled “Build & Run”nsx configure --app-dir .nsx build --app-dir .nsx flash --app-dir . # requires EVB with onboard PDM micnsx view --app-dir . # opens SWO viewerExpected Output
Section titled “Expected Output”The SWO viewer will print once at startup, then peak amplitude every 100 frames (~3 s at 16 kHz / 480 samples per frame):
Audio capture started: 16000 Hz, 1 ch, 480 samples/frameFrame 100 peak=1842Frame 200 peak=2105Frame 300 peak=947Frame 400 peak=3210Peak values depend on ambient noise. Silence gives values near 0; speaking near the mic gives values in the thousands (int16 range).
How It Works
Section titled “How It Works”- Configures the PDM peripheral at 16 kHz mono via
nsx_audio_init() - DMA transfers 480-sample (30 ms) frames into a ping-pong buffer
- A callback fires per frame; the main loop computes peak amplitude
- DMA buffers use
NSX_MEM_SRAM_BSSplacement — the DMA engine on Apollo5 cannot access TCM
Hardware Notes
Section titled “Hardware Notes”- The Apollo510 EVB has an onboard PDM MEMS microphone
- No additional hardware or wiring is needed
- PDM clock and data pins are set by the EVB board definition