PAdicMIDI — offline applet

Hierarchical, ultrametric and p-adic analysis of symbolic music. Drop in a Standard MIDI file, choose a prime, read the coherence invariant.
Self-contained applet.html · v1.0.0 · MIT licence · Author: J. Rogelio Pérez-Buendía (CIMAT-Mérida). runs entirely in your browser, no network · Versión en español

0. Before you start — instructions and references

What files can I upload?

  • Standard MIDI files (.mid or .midi), formats 0 or 1.
  • Recommended: 100 – 4 000 notes, duration 30 s – 10 min.
  • The in-browser engine treats all tracks as a quasi-monophonic stream; for rigorous polyphonic analysis use the Python package.
  • Not supported: SMPTE division, MIDI type 2, encrypted files, audio (WAV/MP3).

What does the applet do with your MIDI?

  1. Parses the notes and builds a 12-D chromagram (pitch classes) on a beat-synchronous grid with bin Δb = 1/12.
  2. Quantises windows of length pn by k-means at each level n.
  3. Builds the tower S1 → … → SNmax with forced inverse system πn+1,n.
  4. Computes the coherence invariant Cohπ(p,n) and compares it against the architectural floor 1/p.

What results will you see?

  • A table with Cohπ(p,n), the floor 1/p and a status badge.
  • Four musical views: temporal chromagram with prototype segmentation, prototype catalogue, inverse system π and the full p-adic tree.
  • CSV download of the values.

Privacy

Your MIDI file never leaves your browser. The applet makes no network requests, uses no cookies and sends no telemetry. You can save this HTML and run it fully offline.

What to expect as a diagnosis (with examples)

When a piece satisfies the structural hypotheses (SC) sibling-cover and (AI) ancestor-inclusion and one chooses r = p, Proposition 3.1 of paper [2] predicts Cohπ(p,n) = 1/p exactly for all n (the architectural null floor). Deviations above the floor are the quantitative fingerprint of polyphonic texture or non-canonical metric structure.

Reference piece p Expected outcome
BWV 1007 — prelude (monophonic, bundled demo) 2 Cohπ(2,n) = 0.500000 exactly at every level. The badge should read on floor.
BWV 1007 — prelude 3 Range [0.67, 0.999] above the floor 1/3 ≈ 0.333. Difference explained by r ≠ p: the binary content does not align with the ternary grid.
Polyphonic Bach (BWV 1049, 1050, 1079) 2 Measurable deviation from the floor: Cohπ typically between 0.55 and 0.95 depending on the movement. This is the texture discriminant reported in [2].
Any piece, high levels with a small corpus If |Sn+1| is very small the value loses statistical stability — interpret with caution.

Key references

Start with the demo: click Load BWV 1007 demo below, keep the default parameters (p=2, Nmax=4) and run the analysis; you should see three rows with Cohπ = 0.500000. Then try p=3 on the same file to observe the contrast.

1. Load a MIDI file or a demo

Upload your own MIDI, drop it onto the box below, or start with one of the four bundled demos. Demos are useful to see what the theory predicts for known structures.

Expected results per demo (with K=8, Nmax=4, seed 42)
Demo Cohπ(2,·) Cohπ(3,·) Reading
BWV 1007 — prelude (mono Bach) [0.500, 0.500, 0.500]
floor 0.500
[1.00, 1.00, 0.54]
floor 0.333
The paper's canonical case. Binary cello pulse puts p=2 exactly on the floor. With p=3 the invariant saturates: there is no ternary alignment.
Toy binary (synthetic, p=2) [0.500, 0.500, 0.500]
floor 0.500
[0.44, 0.56, 0.35]
floor 0.333
Designed to satisfy (SC) and (AI) at p=2. Hits the floor for p=2; fluctuates near the ternary floor.
Toy ternary (synthetic, p=3) [0.25, 0.50, 0.50]
floor 0.500
[0.333, 0.41, 0.27]
floor 0.333
Designed to satisfy (SC) and (AI) at p=3. The binary view is atypical (n=1 dips below). With p=3 level 1 hits the floor 1/3 exactly.
BWV 1079 — Crab canon (polyphonic) [0.500, 0.500, 0.500]
floor 0.500
[1.00, 0.96, 0.81]
floor 0.333
Real polyphony with two voices in retrograde imitation. Strict binary structure. Same qualitative profile as BWV 1007.

To reproduce the values: load the demo, set p=2 (or 3), click Run analysis. Magnitudes can shift slightly with K and seed; the qualitative pattern (on-floor vs off-floor) does not. The column shows levels n=1, 2, 3.

Drop a .mid file here.

2. Parameters

Defaults reproduce the gold-standard runs of the companion papers (J. R. Pérez-Buendía, 2026) with the proviso that the in-browser implementation uses a simplified MIDI parser limited to monophonic flows; for full reproducibility use the Python package.

About

PAdicMIDI · A Python toolkit for hierarchical, ultrametric, and p-adic analysis of symbolic music data. Jesús Rogelio Pérez Buendía (publication name: J. Rogelio Pérez-Buendía), researcher, CIMAT-Mérida. ORCID 0000-0002-7739-4779 · Web www.cimat.mx/~rogelio.perez · Email rogelio.perez@cimat.mx. Funding: SECIHTI grant CF-2019/217367. Source code: MIT licence. Companion papers: Prime-power indexed multiscale graph diagnostics (JMM, 2026) and Profinite hierarchical patterns and prime-indexed multiscale invariants in symbolic music (2026).