A cross-platform, low-level audio input and output library written in pure Rust.
CPAL is a low-level audio I/O library for Rust that provides a unified interface for interacting with audio hardware across multiple platforms. It enables Rust applications to enumerate devices, query stream formats, and build real-time audio input and output streams. The library abstracts platform-specific audio APIs to offer cross-platform compatibility with minimal overhead.
Rust developers building audio applications, such as digital audio workstations, synthesizers, audio effects processors, or any software requiring real-time audio input/output across desktop, mobile, or web platforms. It is also suitable for developers needing fine-grained control over audio hardware and stream configurations.
Developers choose CPAL for its comprehensive cross-platform support, including Android, iOS, Linux, macOS, Windows, BSD, and WebAssembly, via native backends like ALSA, JACK, CoreAudio, WASAPI, and ASIO. Its unique selling point is providing a minimal, portable abstraction that prioritizes flexibility and low-level control without sacrificing compatibility, with optional features for real-time thread priority and custom host implementations.
Cross-platform audio I/O library in pure Rust
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports Android, iOS, Linux, macOS, Windows, BSD, and WebAssembly with native backends, ensuring wide compatibility for cross-platform audio applications as detailed in the README.
Offers backends like ALSA, JACK, CoreAudio, WASAPI, ASIO, and Web Audio API, allowing developers to choose based on system or performance needs, including low-latency options such as ASIO and Audio Worklet.
Provides APIs for enumerating devices, querying formats, and configuring buffer sizes, enabling precise tuning for real-time audio streams with minimal overhead, as shown in the stream configuration examples.
Includes features for real-time thread priority and custom host implementations via the 'custom' feature, catering to high-performance and specialized audio systems beyond standard backends.
Setting up certain backends, especially ASIO on Windows, requires installing LLVM/Clang, managing the ASIO SDK, and setting environment variables, which the README admits can be error-prone and cumbersome for newcomers.
On Linux, ALSA development files are required even for non-ALSA backends, and buffer size management with `BufferSize::Default` can cause audio glitches, necessitating manual configuration and troubleshooting.
Focused solely on I/O, CPAL lacks any audio mixing, effects, or codec support, requiring developers to integrate additional libraries for most applications beyond basic streaming, which increases complexity.