librockbox_ffi for
your platform — no Rust toolchain needed. From a repo checkout, the loader
walks up to target/release/; override with ROCKBOX_FFI_LIB.
Quick start
Decode a file to PCM
Decoder streams an audio file to interleaved-stereo S16LE PCM one chunk at a
time through the Rockbox codec engine — the same decoders that power playback,
without an output device.
chunks() (or next_chunk()) yields (samples, sample_rate) and stops at
None on end of track; finished() returns (done, code) where code is 0
for a clean end and negative for a codec error.
API
- Handles are context managers —
with Dsp(...) as dsp:frees the native resource on exit. A GC finalizer is the backstop. - Rich values (metadata, status) come back as plain
dicts. - Sample buffers are
array('h')of interleaved-stereo signed 16-bit samples.
Player DSP chain. Every setter applies live and is reflected back by
player.dsp_settings(). The full surface:
EQ — set_eq_enabled / is_eq_enabled, set_eq_preset(EqPreset)
(21 presets: FLAT, ROCK, JAZZ, BASS_BOOST, …), set_eq_band,
set_eq_precut. Tone — set_tone, set_bass, set_treble,
set_bass_cutoff, set_treble_cutoff. Spatial —
set_crossfeed(CrossfeedMode), set_surround, set_channel_mode(ChannelMode),
set_stereo_width, set_balance(balance) / balance() (stereo balance,
-100 full left … +100 full right, 0 = centre). Enhancers — set_bass_enhancement (PBE),
set_fatigue_reduction (AFR), set_compressor, set_dither, set_pitch.
Shuffle / repeat — set_shuffle / is_shuffle_enabled,
set_repeat(RepeatMode) / repeat().For what each parameter does (and sensible ranges), see the official Rockbox
manual: Sound Settings.Interactive console
rb, metadata, Dsp, Player, the enums, and a
FIXTURE sample track preloaded: