soundstream-light
Minimal SoundStream encoder/decoder tooling with a native C++ CLI and a Python API.
Python Usage (PyPI)
Install package with uv,
uv pip install soundstream-light
Use soundstream_light in Python,
from scipy.io import wavfile
import numpy as np
from soundstream_light import encode, decode
rate, pcm = wavfile.read("test.wav")
waveform = pcm.astype(np.float32) / 32768.0
embeddings, meta = encode(waveform)
recon = decode(embeddings, metadata=meta)
wavfile.write("test_recon.wav", rate, (np.clip(recon, -1.0, 1.0) * 32768.0).astype(np.int16))
The module auto-downloads models on first use if they are missing.
Fetch Models
Use the bundled CLI to download the required .tflite files manually (defaults to ./models or SOUNDSTREAM_MODELS_DIR). If you are working from the repository, prefix the command with uv run so the local package is used.
uv run soundstream-cli models fetch
With models present, you can test the encoder/decoder round trip using the bundled test.wav example:
uv run soundstream-cli encode test.wav test.embeddings
uv run soundstream-cli decode test.embeddings test_recon.wav
Evaluate Round-Trip Quality
Install optional metric dependencies (STOI/PESQ) when you need quality numbers:
uv pip install 'soundstream-light[metrics]'
With models present, you can run the built-in evaluator against the bundled test.wav (or any mono 16 kHz WAV) to get SI-SNR, STOI, optional PESQ, and RTF:
uv run soundstream-cli evaluate test.wav --compute-pesq --save-recon test_eval.wav
Sample results on the bundled test.wav (M1, XNNPACK, 1 thread):
SI-SNR: 7.59 dB
STOI: 0.9676
PESQ: 3.6041
RTF: 0.015
Encode: 0.017 s | Decode: 0.023 s
Build from source
You can also build from source code by cloning this repo. Make sure that git, cmake, a C++17 compiler, and typical build tools (e.g. make, ninja, perl) are available.
Prepare TensorFlow Lite headers and libraries:
bash scripts/setup_tflite_from_source.sh --clean --branch v2.15.0 --generator Ninja --build-type Release
Configure and build:
cmake -S . -B build \
-DTFLITE_SOURCE_DIR="$(pwd)/third_party/tflite-src" \
-DTFLITE_BUILD_DIR="$(pwd)/third_party/tflite-src/cmake_build"
cmake --build build --target soundstream_cli
The binary appears at build/soundstream_cli. Then build PyPI artifacts from source,
export TFLITE_SOURCE_DIR="$(pwd)/third_party/tflite-src"
export TFLITE_BUILD_DIR="$(pwd)/third_party/tflite-src/cmake_build"
uv build
Verify the Build
Run the C++ round-trip test (requires models):
# Download models once if you haven't already
uv pip install dist/soundstream_light-*.whl
uv run soundstream-cli models fetch
cmake --build build --target soundstream_roundtrip_test
ctest --test-dir build --output-on-failure
Python unit tests can be executed without compiling the extension:
uv run python -m unittest tests.test_api
License
Apache License 2.0 — see LICENSE.
Acknowledgements
This project builds on the source code of Lyra.
Release files for soundstream-light 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| soundstream_light-0.1.4.tar.gz | 513.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| soundstream_light-0.1.4-cp312-cp312-manylinux_2_39_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.39+ x86-64 | Details |
Total release size: 3.2 MB
Release files / soundstream_light-0.1.4.tar.gz
| Download URL | soundstream_light-0.1.4.tar.gz |
|---|---|
| Size | 513.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcdb16f6361b63c134ebba48202ae6248a722d021b09a231f938152318e1edb6
|
|
BLAKE2b-256 checksum How to use checksums |
1304d829e7900848cc7638bdfcbd5f2735d1d58324e676f09a8921a92aee2a1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2025.
Transparency logRelease files / soundstream_light-0.1.4-cp312-cp312-manylinux_2_39_x86_64.whl
| Download URL | soundstream_light-0.1.4-cp312-cp312-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.12 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
4c0d374c9cca94045866217da0ca2c0eb76aea0a13806e6bd5c4b3e43c264ebe
|
|
BLAKE2b-256 checksum How to use checksums |
493ad3807435d549062871240f830f5b80ead9f83699bdaed92449dd68122b5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2025.
Transparency log