audioif

audioif — the audio hardware layer: the platform drivers under the audio pump.

audioif The part of the audio stack that knows what a thread is, where the clock comes from and where the sound goes: a pinned task and the I2S peripheral on ESP32, a native thread on unix and Windows, and a CircuitPython-shaped audiobusio.I2SOut over all of it. With it in a firmware, a graph keeps an exact clock while a screen redraws and a USB stack runs, and audiodev plays through it without being asked. The portable half of the pump, and every DSP node, is audiodsp.

Live Pure-Python Device

Install

Built into firmware beside audiodsp

There is nothing to pip install. audioif is a C module you build into MicroPython 1.29 with audiodsp beside it: clone the two side by side and include both manifests in the manifest your build already uses.

include("/path/to/audiodsp/manifest.py")
include("/path/to/audioif/manifest.py")

The drivers cover ESP32, unix and Windows; other ports skip the module, and the engine runs on one thread with no hardware. micropython-pydevices keeps this pair as its audio.py preset, with boards to build it for. Building it into a firmware has the rest.

Try this first

Ask the firmware, then play through it
>>> import audiopump
>>> audiopump.driver()
'esp32'          # or 'pthread', 'win32', 'none'
import audiobusio, audiocore, board

out = audiobusio.I2SOut(board.GPIO12, board.GPIO13, board.GPIO14)
out.play(sample, loop=True)      # any audiocore sample

'none' means the driver did not link into your build. Once it answers, audiobusio.I2SOut behaves like CircuitPython's: CircuitPython 10.3.0's own I2SOut example runs apart from the three pin names.

Read more

Depth lives in the repository

Newcomer's guide

Where the portable pump ends and the platform driver begins.

What each port implements

The ESP32 task and I2S peripheral, the unix and Windows threads, and what WebAssembly does instead.

audiodsp

The engine this drives: every DSP node and the portable half of the pump.

Release v0.1.0

The first public release, proved on an ESP32-P4 and an ESP32-S3.