🌿 silk-decode v1.0.0 · MIT
Decode Tencent SILK voice files (WeChat voice messages) to real WAV — handles the 0x02 prefix, no ffmpeg needed.
Why this exists
Two pitfalls bite everyone processing WeChat voice payloads:
- The Tencent
0x02prefix. Many Tencent encoders write an extra byte before the#!SILK_V3header. Standard decoders (includingsilk-wasm) fail because they expect the header at byte 0. - Raw PCM, not WAV. The common Python decoder (
pilk.decode) emits raw s16le PCM — unreadable by audio tools unless you know to wrap it withffmpeg -f s16le.
silk-decode fixes both: it strips the prefix transparently and wraps the PCM into a proper WAV container using only the Python standard library.
Install (pip, v1.0+)
pip install "silk-decode[audio] @ git+https://mandrilly.com/git/silk-decode.git"
Library core is dependency-free; decoding requires the audio extra (pilk ≥ 0.2).
Quick start
silk-decode voice.silk # → voice.wav silk-decode voice.silk voice.wav --rate 24000 silk-decode voice.silk --json # machine-readable summary
Honest exit codes: 0 success · 1 invalid input · 2 unexpected decoder failure.
Source
git clone https://mandrilly.com/git/silk-decode.git
Requires Python 3.9+. Test fixtures include both clean and Tencent-prefixed payloads. The 0x02 fix mirrors a production recipe validated by lab roundtrip (RMS preserved, delay-compensated correlation 0.97).