Python bindings for the dss-codec Rust decoder
Project description
pydsscodec
Python bindings for the Rust dss-codec decoder.
pydsscodec decodes Olympus DSS and DS2 audio directly in Python through a
native Rust extension. It mirrors the core dss-codec model: top-level decode
and decrypt functions plus streaming decoders.
Features
- Decode DSS and DS2 files from paths or bytes
- Normalize encrypted DS2 input back to plain container bytes
- Stream decode in chunks without forcing a whole-file convenience path
- Load native Rust code in-process instead of shelling out to a CLI
- In our benchmark, achieved roughly 150x faster DSS decoding and 50x faster streamed DS2 decoding than the reference Python decoders
Installation
pip install pydsscodec
If a prebuilt wheel is not available for your platform, installation will build the Rust extension locally.
Prebuilt wheels are currently published for:
- Linux
x86_64 - macOS
arm64 - Windows
x86_64
Other platforms install from source and require a local Rust toolchain.
Usage
Decode a file:
from pydsscodec import decode_file
audio = decode_file("recording.ds2")
print(audio.format, audio.sample_rate, audio.native_rate, audio.duration_seconds)
print(audio.sample_count)
Decode in-memory bytes:
from pydsscodec import decode_bytes
audio = decode_bytes(data)
Decrypt encrypted DS2 input to plain container bytes:
from pydsscodec import decrypt_file
plain_ds2 = decrypt_file("encrypted.ds2", password="secret")
Stream decode in chunks:
from pydsscodec import DecryptingDecoderStreamer
decoder = DecryptingDecoderStreamer(password="secret")
with open("recording.ds2", "rb") as handle:
while chunk := handle.read(4096):
chunk_samples = decoder.push(chunk)
# process chunk_samples here
final_samples = decoder.finish()
print(decoder.format(), decoder.native_rate(), len(final_samples))
Detect the container format without decoding:
from pydsscodec import detect_format
fmt = detect_format(data)
print(fmt) # "dss_sp", "ds2_sp", or "ds2_qp"
API
Top-level functions:
decode_file(path, password=None) -> DecodedAudiodecode_bytes(data, password=None) -> DecodedAudiodecrypt_file(path, password=None) -> bytesdecrypt_bytes(data, password=None) -> bytesdetect_format(data) -> str | None
Streamer classes:
StreamingDecoder()DecryptStreamer(password=None)DecryptingDecoderStreamer(password=None)
Streamer methods mirror the Rust API:
push(data)finish()format()native_rate()
Bulk decode returns a DecodedAudio object with:
samples: decoded mono samples aslist[float]sample_rate: sample rate of the returned samplesnative_rate: original sample rate of the source codecformat: one of"dss_sp","ds2_sp", or"ds2_qp"sample_countduration_seconds
Notes
- The streaming classes are the preferred scalable interface for large inputs.
- Bulk decode returns samples as a Python list.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydsscodec-0.1.4.dev0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: pydsscodec-0.1.4.dev0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 223.5 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d182bfb65dc63e2f01c63f495ca723b2cdc33001d3c16dfeb16f0c3f074ae04a
|
|
| MD5 |
217f31350d45eb0c6801bbfc8f82a4b5
|
|
| BLAKE2b-256 |
a62e50acc35de9732b48012702e8ebaa06b0aa3435a36cadc9fed7d40f210db0
|
Provenance
The following attestation bundles were made for pydsscodec-0.1.4.dev0-cp39-abi3-win_amd64.whl:
Publisher:
release.yaml on gaspardpetit/pydsscodec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydsscodec-0.1.4.dev0-cp39-abi3-win_amd64.whl -
Subject digest:
d182bfb65dc63e2f01c63f495ca723b2cdc33001d3c16dfeb16f0c3f074ae04a - Sigstore transparency entry: 1340801565
- Sigstore integration time:
-
Permalink:
gaspardpetit/pydsscodec@c1018abb764977758f406ecb636f52778aa0c179 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/gaspardpetit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@c1018abb764977758f406ecb636f52778aa0c179 -
Trigger Event:
release
-
Statement type: