23 releases

Uses old Rust 2015

0.13.0 May 13, 2024
0.12.0 Jan 16, 2024
0.10.7 Dec 12, 2023
0.10.3 Oct 6, 2022
0.5.1 Mar 23, 2018

#528 in Audio

Download history 172/week @ 2024-03-04 152/week @ 2024-03-11 135/week @ 2024-03-18 212/week @ 2024-03-25 191/week @ 2024-04-01 143/week @ 2024-04-08 197/week @ 2024-04-15 260/week @ 2024-04-22 360/week @ 2024-04-29 367/week @ 2024-05-06 594/week @ 2024-05-13 417/week @ 2024-05-20 348/week @ 2024-05-27 158/week @ 2024-06-03 217/week @ 2024-06-10 430/week @ 2024-06-17

1,160 downloads per month
Used in 4 crates (via cubeb-core)

ISC license

24K SLoC

C++ 15K SLoC // 0.1% comments C 8K SLoC // 0.1% comments Rust 635 SLoC // 0.1% comments Shell 9 SLoC

cubeb-rs ISC License

A cross-platform audio library in Rust.


Provides access to the following:

  • Multiple audio backends across multiple platforms. See here for details.
  • Enumeration of available audio devices.
  • Opening input, output and duplex audio streams with control over latency, sample rate, channel layout, state transitions, data handling and more.


Currently, cubeb-rs is based on a set of bindings to the original cubeb C++ library most notable for its use as the audio backend within Gecko, Mozilla's browser engine. The long-term goal for cubeb-rs is to become independent of the C++ library and provide a pure-Rust implementation down to the level of the platform API eventually replacing the original within Gecko where possible.

In order to achieve this goal cubeb-rs is structured in a manner that supports backend implementations in both pure-Rust and via bindings to the C++ implementation, allowing for progressive replacement. So far, pure-Rust implementations exist for:

The plan is to consolidate all cubeb-related projects (including backend implementations) under a single repository here in the near future.

While cubeb is primarily renown for its use within Gecko, contributions and use from projects outside of Gecko is very welcome.


The following crates are included within this repository:

Crate Links Description
cubeb crates.io docs.rs The top-level user API for cubeb-rs. See the cubeb-api subdirectory. Depends on cubeb-core.
cubeb-core crates.io docs.rs Common types and definitions for cubeb rust and C bindings. Not intended for direct use. Depends on cubeb-sys.
cubeb-sys crates.io docs.rs Native bindings to the cubeb C++ library. Requires pkg-config and cmake
cubeb-backend crates.io docs.rs Bindings to libcubeb internals to facilitate implementing cubeb backends in Rust. Depends on cubeb-core.