Skip to main content

pydefmon

test PyPI

Pure-Python reader, writer, and player for defMON C64 tracker tunes (latest V20201008 on csdb). DefmonPlayer runs a tune's own relocatable replay on a jennings 6502 and emits the per-frame SID register writes, verified byte-exact over whole songs against the sidtrace sidplayfp oracle on real HVSC tunes. Each play call runs the replay as a pysidtracker playspec (SpecPlayer), held to the replay's own 6502 over whole songs; a replay the spec does not describe runs its 6502.

Reads .sid files (PSID/RSID containers), bare .prg editor workfiles, and defMON's own pack-save export PRGs (SHIFT+P: the $1000 raw export and the $0801 executable with its BASIC stub + host boot) through the shared pysidtracker base, decoding all of them to the same $1800..$7166 structural model — including the stereo (2SID) SID#2 arranger pages and the per-tune tempo fields on the runtime-state page. Prehistoric 2008-build worktunes (raw $1700 saves with no RLE codec) are detected by load address and rejected with a specific DefmonParseError (see docs/format.md). A .prg workfile is the composer's editor form, the export PRGs and .sid the packer's canonical form — the same tune, not the same bytes — compare them with DefmonSong.diff (not a raw snapshot ==). The relocatable player is located by signature; container headers are not trusted; DefmonPlayer plays PSID/RSID replays and export PRGs, and rejects .prg workfiles (use DefmonSong to read those).

Install

pip install pydefmon

Usage

from pysidtracker import song_frames
from pydefmon import DefmonSong, DefmonPlayer

# Read / edit a tune (either container auto-dispatches on magic).
song = DefmonSong.from_file("tune.sid")
print(song.pattern_events(0)[:4])
print(song.sidtab_row(0))

# Play a .sid replay: per-frame SID register writes / grid.
player = DefmonPlayer("tune.sid")           # bytes, path, or SidImage
for reg, value in player.play_frame():      # reg is a 0..24 SID register offset
    ...
grid = DefmonPlayer("tune.sid").render_grid(song_frames("tune.sid"))   # whole song x 25 registers

Tune.from_song(song) reduces an editor song, and Tune.from_replay(mem) / Tune.from_player(sid) a replay's memory after init, to what its player reads, as text in a lark grammar with a canonical form for semantic comparison.

See docs/spec.md for the play spec, its public binding API and standard notes, and docs/usage.md for editing, the register-write API, and the shared pysidtracker command line (info / reglog / wav, which pydefmon plugs into), and docs/format.md for the canonical file-format and runtime-RAM reference. The HVSC oracle survey runs the player against every HVSC defMON tune.

Development

pip install -e ".[dev]"
pytest -n auto

Tests that need real defMON tunes fetch + cache them on demand (the copyright editor workfiles from the csdb release, the HVSC replays for the corpus) into pysidtracker's .tunecache ($PYSID_TUNECACHE) and skip when offline; nothing needs pre-populating.

License

GPL-3.0-or-later. See LICENSE.

Metadata

Release files for pydefmon 0.17.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 pydefmon 0.17.0
File Size Uploaded Provenance Actions
pydefmon-0.17.0.tar.gz 127.8 kB With provenance Details for pydefmon-0.17.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydefmon 0.17.0
File Interpreter ABI Platform Actions
pydefmon-0.17.0-py3-none-any.whl Python 3 none any Details for pydefmon-0.17.0-py3-none-any.whl

Total release size: 206.0 kB

Release files / pydefmon-0.17.0.tar.gz

Download URL pydefmon-0.17.0.tar.gz
Size 127.8 kB
Tags Source
SHA-256 checksum
How to use checksums
edf607cadf9d9fbfdbf2e60b92a63879f25eed89e7e88bb1eeb24b500ccaafed
BLAKE2b-256 checksum
How to use checksums
9da38dad86f8ebf50218ee08515f3aa6b042a8742e71a131f012247abfcdcb70
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 Oct 31, 2026.

Transparency log

Release files / pydefmon-0.17.0-py3-none-any.whl

Download URL pydefmon-0.17.0-py3-none-any.whl
Size 78.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a90e3b5df58b09bae7f1846e7c89f6ef006183604c67f4cf64bed67fb5d690c
BLAKE2b-256 checksum
How to use checksums
795bf0e4a1d68a9c230420746e2ef09d846b97a1be372f73307907535944863c
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 Oct 31, 2026.

Transparency log

Security for pydefmon 0.17.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydefmon-0.17.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 Oct 31, 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