audiodev.auto

Optional host backend selection. Backends never import this module.

audiodev.auto.select_backend()[source]

Return the name of the first usable output backend.

Search order: OMNIPYTHON_AUDIO if set, then the backends a board config asked for with require (see backends), then the ones in the box in the documented probe order: wasm, Web Audio, Windows, SDL2, pygame, then ALSA on a Linux machine with a sound card and neither SDL2 nor pygame.

audiodev.auto.pcm_out(format=None, **kwargs)[source]

Construct a raw PCMOutput via select_backend.

Push bytes at it with write(). This is what a consumer that already has PCM wants – a Connect speaker, a USB audio pump – and it needs no audiodsp, because no sample graph is ever pulled.

audiodev.auto.pcm_in(format=None, **kwargs)[source]

Construct a raw PCMInput via select_backend.

audiodev.auto.audio_out(format=None, **kwargs)[source]

Construct an AudioOut sample player.

play(sample) over a CircuitPython-shaped audiosample. This is what a board’s audio_out role returns, and the name means the same thing here as it does there – see pcm_out for the raw sink.

chunk_ms/lookahead_chunks/max_catchup_chunks go to the AudioOut pump; everything else goes to the transport factory. latency="low" also shrinks the pump’s chunk to 20ms (a 40ms schedule with the default 2-chunk lookahead) – the transport profile alone cannot lower note-to-sound latency below what the pump keeps rendered ahead.