Skip to main content

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) -> DecodedAudio
  • decode_bytes(data, password=None) -> DecodedAudio
  • decrypt_file(path, password=None) -> bytes
  • decrypt_bytes(data, password=None) -> bytes
  • detect_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 as list[float]
  • sample_rate: sample rate of the returned samples
  • native_rate: original sample rate of the source codec
  • format: one of "dss_sp", "ds2_sp", or "ds2_qp"
  • sample_count
  • duration_seconds

Notes

  • The streaming classes are the preferred scalable interface for large inputs.
  • Bulk decode returns samples as a Python list.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydsscodec-0.1.0.tar.gz (110.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydsscodec-0.1.0-cp39-abi3-win_amd64.whl (223.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

pydsscodec-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (379.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

pydsscodec-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (329.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file pydsscodec-0.1.0.tar.gz.

File metadata

  • Download URL: pydsscodec-0.1.0.tar.gz
  • Upload date:
  • Size: 110.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydsscodec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c8219fc69957a287688c16b0f833a6c8545b050e54c70f89e90584a4343bc275
MD5 35ec0fcd8736435ccbaab370b843c8bb
BLAKE2b-256 9ced1af8bbb7e63693e1b110904549e1561a43834de1e9cae760d9f7ab901f09

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydsscodec-0.1.0.tar.gz:

Publisher: release.yaml on gaspardpetit/pydsscodec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydsscodec-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pydsscodec-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 223.1 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

Hashes for pydsscodec-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 023c68f0d945a4ad85e8ca77478d3c53584f965a99b21d492fee943d52f50465
MD5 7735e95edd50760a7842f76af5fc248a
BLAKE2b-256 bb9569020aa360f503d4007a4cacf3459c7d8e7cb9a739a3c02e5216c8d23650

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydsscodec-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: release.yaml on gaspardpetit/pydsscodec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydsscodec-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydsscodec-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57d20e705d0dfed337c154904e89c27e2ecbe9b6caa6a3634714ba5afd2adf53
MD5 239b9233593b9fc2f847acb49ef1ef0b
BLAKE2b-256 aca284e828f40d82442f101ca8a1b6eac02a6d421d7805448e03fba921860958

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydsscodec-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on gaspardpetit/pydsscodec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydsscodec-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydsscodec-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc0e97ec8e198939e748cac7abab5c8a89c328e9ffa4b57217f20e47d974ff97
MD5 61ab93c357d0f86e3d72e12ec4ee889a
BLAKE2b-256 f067d6571567e7e503967db768415e7cda2f454c9d9a56491ec65758ea25e72c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydsscodec-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yaml on gaspardpetit/pydsscodec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page