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,
          pipeline=False)  # pipeline=True: voices, filter and output on three threads, same samples
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
grid = envelope_grid(states, programs, cycles)  # (N, P, 2) digests of every program from every state
                               # (an ENVELOPE_STATE array): equal digests, same envelope and future
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. patches/0006-state-fc-width.patch widens the saved filter cutoff to its full 11 bits, so a restored chip keeps the cutoff's high bits through later writes to register 0x15.

clock, run, serve, trace, envelope_trace, envelope_phases, envelope_run, envelope_runs, envelope_grid, 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.

pipeline=True splits clock, run and serve across three threads with identical samples and state; see docs/pipeline.md.

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++20 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.6.1

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.6.1
File Size Uploaded Provenance Actions
pylibresidfp-0.6.1.tar.gz 190.9 kB With provenance Details for pylibresidfp-0.6.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pylibresidfp 0.6.1
File Actions
pylibresidfp-0.6.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for pylibresidfp-0.6.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pylibresidfp-0.6.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for pylibresidfp-0.6.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
pylibresidfp-0.6.1-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.6.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pylibresidfp-0.6.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for pylibresidfp-0.6.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
pylibresidfp-0.6.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for pylibresidfp-0.6.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pylibresidfp-0.6.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for pylibresidfp-0.6.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Total release size: 1.4 MB

Release files / pylibresidfp-0.6.1.tar.gz

Download URL pylibresidfp-0.6.1.tar.gz
Size 190.9 kB
Tags Source
SHA-256 checksum
How to use checksums
142f74f4c78404e4845b2072cefc758f9aa39dc9d507858bd6e9fbf99a682be5
BLAKE2b-256 checksum
How to use checksums
d00f8bee5683a1da32ab2307b386ae9fa73c20f76641ceaf1e38d2e441b55751
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.6.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pylibresidfp-0.6.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 213.8 kB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
fc2ec7d13e325f9088d5fb281d49880097ac499c5b54d0c263c0fdc8e1f8d0f0
BLAKE2b-256 checksum
How to use checksums
3e190d14e05f85b0c8bfd523ed744df922443b7214c7a00016563ec432ef2926
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.6.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL pylibresidfp-0.6.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 198.2 kB
Tags CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
0710a1f1201a1255c5bcd5d9e7a0a7ddf27d6534a827c29b5658fe54010fbd5b
BLAKE2b-256 checksum
How to use checksums
d37198a74d3532e0b45c70917716a2596feccfe0a4ca33e818cad2341f327cd5
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.6.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pylibresidfp-0.6.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 213.7 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
589ca343beca5a47824a3fa0c99f6f3930694f9d96da4e847f3c63b5285d6a2e
BLAKE2b-256 checksum
How to use checksums
5dab6a21ee4cbff39f2911765faeb1871ef8a3af2384d9a1076a9a4b34f6effb
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.6.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL pylibresidfp-0.6.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 198.2 kB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
b9629b08bcd84733cc3590ba5ae0562eda455f79b07a85cbe1f402ac48cf5d02
BLAKE2b-256 checksum
How to use checksums
049ba9a2b59b4ad1dc6700412ded51320af96b391a1abfdf22165f847c779a07
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.6.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pylibresidfp-0.6.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 213.4 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e34412ecf334cb463119eab31045cdeb020c3e575d2728335472671b763c8b59
BLAKE2b-256 checksum
How to use checksums
503c3c2563e676197494ef3d79dc3a4f7587266ec2aa2e4b56a6c82b1c31a0f1
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.6.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL pylibresidfp-0.6.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 197.6 kB
Tags CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
1f4c599ece1fa96352070cef9c031dc2db714b4ddfca143a1fd12e9bc9dedc0d
BLAKE2b-256 checksum
How to use checksums
b7430ebd2df089981319b677c0ebd29ffd82b7edafa9268b7b6831ae5ff17fcc
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.6.1

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.6.1.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