Skip to main content

pylibresidfp

pybind11 binding of libresidfp (the reSIDfp SID emulator) with chip state save/restore, a deterministic output and a GIL-free render loop.

from pylibresidfp import SID

sid = SID(model="6581", clock_hz=985248.0, sampling_hz=44100.0, method="decimate", filter=True)
sid.write(24, 15); sid.read(27); sid.peek(27); sid.reset()
sid.cycle                      # absolute cycle count, starts at 0
sid.clock(cycles)              # np.int16 samples for those cycles
sid.run(writes, until)         # writes: (N, 3) ints or [(cycle, reg, value), ...], absolute cycles
sid.serve(writes, cycle, reg)  # run to `cycle`, then read(reg): the body of a NativeSid on_read
sid.voices()                   # per-voice envelope (LFSR, rate, counter, state, ...) and oscillator state
sid.trace(writes, until)       # run without audio: (cycle, voice, envelope, state) at each envelope change
sid.envelope_trace(v, writes, until, lfsr=None)  # one voice's envelope alone from a copy (its
                               # rate counter's LFSR set to lfsr if given): the chip is untouched
sid.envelope_phases(v, writes, until)  # envelope_trace for every rate-counter phase at once: Phases
                               # (pieces, events, count, states) with .trajectory(k), exact for each k;
                               # events are ramps of envelope steps; .expand(table) -> (ids, times)
state = sid.envelope_state(v)  # that voice's envelope generator as bytes: equal states, equal bytes
trace, end = envelope_run(state, writes, until, start)   # from pylibresidfp import envelope_run:
                               # envelope_trace from `state` (taken at cycle start) with no chip,
                               # event-driven; regs 4/5/6 are control/AD/SR, others ignored
runs = envelope_runs(state, [writes_a, writes_b], until, start)  # several candidates, one call
state = sid.save_state(); sid.restore_state(state)
twin = sid.copy()              # same parameters and state; SID is also picklable

run clocks to each write's cycle, writes it, then clocks to until. Write cycles must not precede sid.cycle or each other and must not exceed until; violations raise ValueError. serve discards the samples it produces (use run to keep audio).

trace clocks the oscillators and envelopes only (libresidfp's clockDigital), so a chip used for tracing no longer renders the same audio as one that was not. voices and trace read libresidfp's internals through patches/0002-probe-access.patch, which befriends a reSIDfp::Probe class. patches/0003-zero-state-padding.patch zeroes the saved state's struct padding, so save_state is reproducible byte for byte; patches/0004-initialise-params.patch gives the filter parameters libresidfp keeps for it their defaults rather than uninitialised memory.

clock, run, serve, trace, envelope_trace, envelope_phases, envelope_run, envelope_runs, save_state and restore_state release the GIL. Each instance has a busy flag: use from a second thread while a call is in progress raises RuntimeError. Distinct instances run in parallel.

Fed directly from vagrant_moses: sid.run(native_sid.drain_writes(), until).

Determinism

Two instances with the same parameters and writes produce identical samples, for both models and both methods. Upstream libresidfp dithers the filter's float-to-int conversion from a table indexed by a counter held in the process-wide filter-model singleton; patches/0001-deterministic-rounding.patch (applied at build time) replaces the dither with plain rounding. Other process-wide state is immutable after first use (filter and waveform tables). The static setters Filter6581::setFilterRange/setCaps are not exposed. The pinned libresidfp has no noiseLevel, so there is no noise_level option.

State is not portable across builds. sid.cycle is part of the saved state.

Build

git clone --recurse-submodules, then pip install .. Needs CMake >= 3.20, patch and a C++17 compiler. libresidfp is the submodule extern/libresidfp, pinned to a release tag; its version is read from the submodule's configure.ac, and .github/workflows/libresidfp.yml opens a PR when a newer release appears. The build copies its sources and applies patches/ to the copy. Tests: pip install -e .[dev], then pytest -n auto --cov=pylibresidfp. docker build . (build arg PYTHON_VERSION) runs the full lint and test suite.

GPL-2.0-or-later (see COPYING).

Metadata

Release files for pylibresidfp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylibresidfp 0.4.0
File Size Uploaded Provenance Actions
pylibresidfp-0.4.0.tar.gz 183.7 kB With provenance Details for pylibresidfp-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pylibresidfp 0.4.0
File Actions
pylibresidfp-0.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for pylibresidfp-0.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pylibresidfp-0.4.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for pylibresidfp-0.4.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
pylibresidfp-0.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for pylibresidfp-0.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pylibresidfp-0.4.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for pylibresidfp-0.4.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
pylibresidfp-0.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for pylibresidfp-0.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pylibresidfp-0.4.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for pylibresidfp-0.4.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Total release size: 1.3 MB

Release files / pylibresidfp-0.4.0.tar.gz

Download URL pylibresidfp-0.4.0.tar.gz
Size 183.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5b567f2fae8fd2448b40b7849984fbe0b64765280d1dc9acb47b717838bb5f0a
BLAKE2b-256 checksum
How to use checksums
64d2fbcb9fa15140cc0ecafe601e28680b45dce6a06b8a3bae9cbd61119d9213
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 1, 2026.

Transparency log

Release files / pylibresidfp-0.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pylibresidfp-0.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 200.2 kB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e3bcdc9c9cb1a522e90795c966c643cb2dbe40309a7983b2890e9ee7652d1b68
BLAKE2b-256 checksum
How to use checksums
01ca8397177745ad94b7f2f00502efbae57709a0513dd29552534efd7a738c44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 1, 2026.

Transparency log

Release files / pylibresidfp-0.4.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL pylibresidfp-0.4.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 181.1 kB
Tags CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
fdf009426eac2f315fc88031350dfc5437c7486fe076aa88e8208ceac0b6a79a
BLAKE2b-256 checksum
How to use checksums
c0fcd2590569bedc739197407f867f38f14cf083218b81d6b1b8e2e4b9cf3ed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 1, 2026.

Transparency log

Release files / pylibresidfp-0.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pylibresidfp-0.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 200.2 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
fc367e39c5b268ca1bc96ff0963ac36a4a3d1ceb0bc49ee1755e4eab33ec4820
BLAKE2b-256 checksum
How to use checksums
17c00db87c8a2d10bd84d91babf12d04197be8330e8e1519113677ae4e304c7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 1, 2026.

Transparency log

Release files / pylibresidfp-0.4.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL pylibresidfp-0.4.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 181.1 kB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
62a623d1e8002618b1d3ad349adbd31062641fac8874085d1897021c9c7ce61a
BLAKE2b-256 checksum
How to use checksums
7dcb44bd8a5aadaa3cfab24af7ffd56a7df660efc2bef897c2731dd3463b69b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 1, 2026.

Transparency log

Release files / pylibresidfp-0.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pylibresidfp-0.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 199.1 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5efc475f8bef0cf54955783cd6771dba5d8d686e1fd000f4d30478806c0193d9
BLAKE2b-256 checksum
How to use checksums
e9a68ae1078bd35aed394fe1fb5ef85367c211376b7a9c4aa1a3765b1ee4a4d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 1, 2026.

Transparency log

Release files / pylibresidfp-0.4.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL pylibresidfp-0.4.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 180.3 kB
Tags CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
f88300720c01b09e161d3c5ba6651d6fc6dbeaf540e476293ccdbaf29049f5f0
BLAKE2b-256 checksum
How to use checksums
e1bc193e6127b8d089adb00565c3b2ca5a62fcaf17a71221847a3c29fcad776c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 1, 2026.

Transparency log

Security for pylibresidfp 0.4.0

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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for pylibresidfp-0.4.0.tar.gz

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 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page