Skip to main content
Requires Go 1.22+. Calls the native engine through puregono cgo and no C toolchain; the package dlopens a prebuilt librockbox_ffi at process start. From a repo checkout the loader walks up to target/release/; override with ROCKBOX_FFI_LIB.

Quick start

Decode a file to PCM

OpenDecoder runs a file through the Rockbox codec engine and hands back interleaved-stereo S16LE PCM one chunk at a time — decode without an output device.
The codec engine is process-wide: only one Decoder may decode at a time, and always from a single goroutine. A second OpenDecoder blocks until the first is closed.

API

  • Handles own native resources — defer dsp.Close() / defer player.Close() frees them.
  • Rich values (metadata, status) decode into typed structs (Meta, Status); optional tags are nil-able pointer fields.
  • Sample buffers are []int16 of interleaved-stereo signed 16-bit samples.
  • DSP semantics (EQ bands, tone, crossfeed, compressor, …) mirror Rockbox’s own settings — see the official Rockbox manual for what each control does.
Dsp.SetReplaygain and Player.SetReplaygain take different mode integers. Always pass the named constants — DspReplayGain* for the DSP, ReplayGain* for the player. See the overview.

Smoke test