audiodev.alsa_audio
ALSA PCM backend for Linux, straight to libasound with no SDL or pygame.
Playback and capture use ALSA’s own ring buffer in non-blocking mode: a write
takes what fits and waits a little for the rest, and queued_size() is what
the sound card still holds. There is no thread and no callback into Python.
It runs on CPython (through ctypes) and on the unix MicroPython and
CircuitPython builds that have ffi. Import fails unless libasound loads.
device is any name ALSA’s snd_pcm_open takes: "default", the
sound server’s plug-in, when it is left out, or a card such as
"plughw:2,0". devices lists the cards the kernel has.
- audiodev.alsa_audio.devices()[source]
The sound cards’ PCM devices, from
/proc/asound/pcm.Returns a list of dicts:
name(what to pass asdevice, such as"plughw:2,0"),card,device,description, and whether it canplaybackorcapture. It is empty where there are no cards.
- class audiodev.alsa_audio.AlsaPCMOutput(fmt, *, device=None, latency_us=200000, prebuffer_ms=50, poll_ms=2, session=None)[source]
Bases:
_Stream,PCMOutput- xruns
Underruns the card has had since this output opened. A healthy run has none.
- class audiodev.alsa_audio.AlsaPCMInput(fmt, *, device=None, latency_us=200000, poll_ms=2, session=None)[source]
Bases:
_Stream,PCMInput- xruns
audio the caller didn’t read in time.
- Type:
Overruns since this input opened