spine
A neural audio codec for expressive speech.
Spine encodes 24 kHz mono audio into multi-scale FSQ tokens at 1.57 kbps (~88 tokens/s) across four temporal scales (~6 / 12 / 23 / 47 Hz), keeping sequences short for downstream language models. The convolutional decoder is hard-bandlimited at 6 kHz by a fixed crossover; a filtered-noise branch and a complex-STFT head synthesize the high band under purely adversarial supervision, eliminating the high-frequency static typical of GAN codecs.
- 115M-parameter generator: conv encoder/decoder with a 512-d transformer bottleneck (8 + 12 layers)
- Multi-scale FSQ (
pool → quantize → repeat) on a shared latent, with no codebook collapse - Reconstruction losses bandlimited below the crossover; the high band is owned by the DDSP split
Installation
pip install spine-codec
Training pulls in extra dependencies (wandb):
pip install "spine-codec[train]"
For development, clone this repo and run uv sync.
Usage
The pretrained model is downloaded from twangodev/spine-codec on first use; pass --checkpoint to use a local training checkpoint instead.
spine encode --input speech.wav --output codes.pt
spine decode --input codes.pt --output speech.wav
spine recon --input speech.wav --output roundtrip.wav
import torchaudio
from spine import Spine
model = Spine.from_pretrained("twangodev/spine-codec")
audio, sr = torchaudio.load("speech.wav") # 24 kHz mono
codes = model.encode(audio.unsqueeze(0))
reconstruction = model.decode(codes)
Training
spine train --config configs/train.yaml
Training configs live in the repo (not the wheel), so train from a git checkout
with the train extra installed.
YAML configs are sparse overrides on top of the defaults in spine/config.py.
Acknowledgements
Metadata
Release files for spine-codec 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spine_codec-0.1.0.tar.gz | 221.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spine_codec-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 253.5 kB
Release files / spine_codec-0.1.0.tar.gz
| Download URL | spine_codec-0.1.0.tar.gz |
|---|---|
| Size | 221.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3894c7c59f27892be63538d6c8814c857ab47241a1816d8019624c8dc0d208f9
|
|
BLAKE2b-256 checksum How to use checksums |
4f6afaf7784044d7487b30b83c7671ce6fa99c6ce9ab7e060a4a3696371bdceb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 2, 2026.
Transparency logRelease files / spine_codec-0.1.0-py3-none-any.whl
| Download URL | spine_codec-0.1.0-py3-none-any.whl |
|---|---|
| Size | 32.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bde9afc87aac66a6f0ffb974c74669342f7426107917fb4ad30275885e052d8b
|
|
BLAKE2b-256 checksum How to use checksums |
c3def9b1d0a8fb0013f72d97c58cbe0d620945467bc95dbf0ff93b8701b361ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 2, 2026.
Transparency log