CPAL is a low-level cross-platform audio I/O library written in Rust.
The library solves the problem of accessing audio input and output across different operating systems and audio backends by providing a unified interface. It abstracts away platform-specific differences, allowing developers to enumerate audio hosts and devices, inspect device metadata, build streams with configurable sample formats, and control playback through play, pause, and buffer-querying operations. The approach uses platform-native backends: AAudio on Android, CoreAudio on Apple platforms, ALSA on Linux and BSD, and WASAPI on Windows, with optional support for JACK, PipeWire, PulseAudio, ASIO, and Web Audio API depending on the platform.
Developers should choose this library when building audio applications that require direct, low-level control over audio streams across multiple platforms. It suits projects that need fine-grained access to device enumeration, stream configuration, and real-time audio processing. The README explicitly recommends higher-level alternatives like Rodio for simpler audio playback and capture use cases, positioning CPAL as the appropriate choice when lower-level functionality is required.
The project maintains active support across a wide range of platforms and backends, with each backend having clearly documented minimum Rust versions and operating system requirements. Development appears focused on stability and compatibility, as evidenced by the detailed specification of minimum supported versions for each platform-backend combination and the careful documentation of build dependencies, particularly the requirement for ALSA development files on Linux systems regardless of which audio backend is ultimately used.