Skip to main content
Requires Gleam ≥ 1.0 on the Erlang target and OTP 27+ (JSON is decoded with the built-in json module plus gleam/dynamic/decode — no gleam_json dependency). The NIF links the Rust static archive (target/release/librockbox_ffi.a); build it with make (which runs cargo build --release -p rockbox-ffi first if needed) before gleam test.

Quick start

API

rockbox/player

Every mutating function returns the Player, so calls chain with |>. The setters below apply the full Rockbox DSP chain live, mid-playback. DspSettings is a typed record whose sections include equalizer, tone, surround, channel_mode, stereo_width, compressor, dither, pitch, crossfeed, bass_enhancement, and fatigue_reduction.
These knobs map 1:1 to Rockbox’s own Sound Settings. See the official Rockbox manual for what each control does and its value ranges.
  • Dsp and Player are opaque NIF resources, freed by the BEAM garbage collector — no explicit close.
  • PCM crosses the boundary as a BitArray.
The DSP and player use different mode integers: dsp.set_replaygain0 track, 1 album, 2 shuffle, 3 off; player.set_replaygain0 off, 1 track, 2 album. See the overview.

rockbox/decoder

Decode an audio file to interleaved-stereo S16LE PCM (a BitArray), one chunk at a time, straight through the Rockbox codec engine — no output device needed. Decode a file to PCM
  • Decoder is an opaque NIF resource, freed by the BEAM garbage collector — no explicit close.
Codec state is process-wide — only one Decoder decodes at a time. Opening a second decoder blocks until the first has been garbage-collected.
The Gleam and Elixir bindings share the exact same rockbox_ffi_nif.{c,erl} NIF, vendored into each project.