Convert piano MIDI files into Desmos tone() graphs with a local HTML player
Project description
DesmosMIDI
Convert Standard MIDI Files into a prefilled Desmos graph that plays piano music via tone() synthesis—unbounded polyphony, sustain pedal, decay on gain, beat-proportional timeline, optional keyroll/amplitude viz.
V1 is not MIDI2Desmos-style Audio Trace; it uses documented tone(frequency, gain) with a global beat variable T.
Install
PyPI (after the first release is published):
pip install desmosmidi
desmosmidi setup
From a GitHub Release: download desmosmidi-*-py3-none-any.whl, then pip install desmosmidi-*.whl.
Development (this repo):
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
Cutting releases: docs/releasing.md.
Quickstart
See Quickstart.md for the full walkthrough.
desmosmidi setup
desmosmidi # terminal UI
desmosmidi play path/to/song.mid # build + open browser
Or build only: desmosmidi path/to/song.mid (writes dist/<song-name>/).
Keyroll + waveform (optional): desmosmidi path/to/song.mid --viz
Requirements
- Python 3.11+
- Desmos API key for embedded HTML player
- Modern browser with Web Audio (user gesture required for sound)
- Static HTTP server for exports that load
expr/chunks (notfile://)
Commands
| Command | Purpose |
|---|---|
desmosmidi setup |
Save API key to .env |
desmosmidi FILE.mid |
Build player under dist/ |
desmosmidi play FILE.mid |
Build + open in browser |
desmosmidi check FILE.mid |
Preview file info |
See docs/cli.md for flags (--viz, chunking, piano gate).
Output layout
dist/prelude/
player.html # Jinja player; inlined song.meta.json
song.meta.json # tempo map, duration, audio_only, viz pointers
expr/
manifest.json # chunk list + folder specs
chunk-0000.json # batched expressions
viz-data.json # keyroll table (only with --viz)
expressions.json # folder-ordered list (setState / primary load)
viz/notes.json # pitch range, pcm viewport (only with --viz)
expressions.md # paste fallback for desmos.com
song.report.json
song.report.md
Folders (collapsed by default in Desmos): clock (T, B, D, optional V), MIDI helpers (F_*, G_*), audio (tone_*), optional viz.
Player: Play/Stop, Bass (default 1.6×), Decay (default 3.65×), Output master gain. With --viz: Keyroll / Amplitude and No render. Details: docs/viz.md, docs/desmos-playback.md.
Documentation
| Doc | Contents |
|---|---|
| docs/README.md | Topic index |
| docs/viz.md | Keyroll, amplitude, player UX |
| docs/desmos-playback.md | tone(), clocks, API player |
| docs/tempo-map.md | Beats, BPM, ticker recipe |
| Quickstart.md | Setup and first export |
Status
V1 — CLI, MIDI parse, piano gate, sustain/reattack, unlimited voice lanes, chunked tone() export, HTML player, default audio-only export. pytest: 20 tests.
License
Apache License 2.0. See LICENSE and NOTICE (Desmos API disclaimer).
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 Distribution
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 desmosmidi-0.1.0.tar.gz.
File metadata
- Download URL: desmosmidi-0.1.0.tar.gz
- Upload date:
- Size: 51.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53c046f99b77d1994475df2df402c64311bb11dea0ad33a1ebda9518e3517d57
|
|
| MD5 |
1352dd1b87696b16e3fb803da464cb77
|
|
| BLAKE2b-256 |
572fa54332ada982c25cee3077b109b54a7ebeb1c9be1c8a3854ee5011bcb573
|
Provenance
The following attestation bundles were made for desmosmidi-0.1.0.tar.gz:
Publisher:
release.yml on GXboy12345/DesmosMIDI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
desmosmidi-0.1.0.tar.gz -
Subject digest:
53c046f99b77d1994475df2df402c64311bb11dea0ad33a1ebda9518e3517d57 - Sigstore transparency entry: 1598047771
- Sigstore integration time:
-
Permalink:
GXboy12345/DesmosMIDI@9c4b93c036cbc93be54b40e073fbeafafd409fb4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GXboy12345
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c4b93c036cbc93be54b40e073fbeafafd409fb4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file desmosmidi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: desmosmidi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 48.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb8473507308bc2d9d0a0f9cfb55b638d5c245241cb20825a3a182643d4c79bd
|
|
| MD5 |
dd0395b1a2aa5756faf997ec513aad8b
|
|
| BLAKE2b-256 |
611923f2b50dd7aafdeb3a48f4e5153df2477d1d3fcbbf50aaeac4fef21a53c3
|
Provenance
The following attestation bundles were made for desmosmidi-0.1.0-py3-none-any.whl:
Publisher:
release.yml on GXboy12345/DesmosMIDI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
desmosmidi-0.1.0-py3-none-any.whl -
Subject digest:
bb8473507308bc2d9d0a0f9cfb55b638d5c245241cb20825a3a182643d4c79bd - Sigstore transparency entry: 1598047913
- Sigstore integration time:
-
Permalink:
GXboy12345/DesmosMIDI@9c4b93c036cbc93be54b40e073fbeafafd409fb4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GXboy12345
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c4b93c036cbc93be54b40e073fbeafafd409fb4 -
Trigger Event:
push
-
Statement type: