# MIDI to JSON

Convert a Standard MIDI File (.mid/.midi) to JSON — paired notes with pitch names, a raw event stream, or a compact summary. Free, runs in your browser.

## Run it

- **CLI:** `gizza tool midi-to-json "TVRoZAAAAAYAAAABAGBNVHJr…  (or 4d546864000000…)"`
- **Web:** https://gizza.ai/tools/midi-to-json/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/midi-to-json/tool.json

## Inputs

- `input` — MIDI file (base64 or hex) _(field)_
- `encoding` — Input encoding _(field)_
- `format` — Output _(field)_

## Output

- JSON (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `input` — MIDI file (base64 or hex)
- `encoding` — Input encoding
- `format` — Output

Example: `https://gizza.ai/tools/midi-to-json/?input=TVRoZAAAAAYAAAABAGBNVHJr%E2%80%A6%20%20%28or%204d546864000000%E2%80%A6%29&encoding=auto&format=notes`

---

## About this tool

MIDI to JSON turns a Standard MIDI File into readable structured data without uploading the file anywhere. Paste the `.mid`/`.midi` bytes as base64 or hex, choose the output view, and the tool parses the SMF header, tracks, timing division, tempo map, notes, controller messages, program changes, pitch bends, and common meta events.

Use **Notes** when you want a musical view for visualizers, sequencers, games, or data analysis: note-on/note-off pairs are combined into notes with a pitch name such as `C4`, MIDI note number, channel, start time, duration in ticks, duration in seconds, and velocity. Use **Events** when you need the ordered raw event stream for debugging or conversion work. Use **Summary** for a quick overview of track count, duration, BPM, time signature, channels, note count, and track names.

### Worked examples

- Paste the hex example from **Summary — compact overview** to get a small JSON object showing one track named `Piano`, a 120 BPM tempo, 4/4 time, and one note.
- Switch the same example to **Notes** to see that note paired as `C4`, starting at tick `0` with a `480` tick / `0.5` second duration.
- Choose **Events** to inspect the underlying MIDI messages: track name, tempo, time signature, note-on, note-off, and end-of-track.

### Limits and edge cases

- The input must be a Standard MIDI File that starts with the `MThd` chunk. RIFF-wrapped RMID, karaoke variants, and sequencer project files are not decoded unless their bytes begin with a normal SMF header.
- Timing in seconds is calculated from tempo events across the file. SMPTE timecode division is also reported, but musical PPQ files are the common case.
- Output is JSON text, not a playable audio render. This tool does not synthesize MIDI to sound and does not convert JSON back into a MIDI file.
- Program numbers are emitted as numbers; General MIDI instrument names are intentionally not guessed.

## FAQ

<details>
<summary>Can I upload a .mid file directly?</summary>

This page accepts the MIDI bytes as base64 or hex text. If you have a `.mid` file locally, base64-encode it first, paste the text into the input field, and leave encoding on **Auto** or set it to **Base64**. The CLI can also receive the same base64 or hex string.

</details>

<details>
<summary>What is the difference between Notes, Events, and Summary?</summary>

**Notes** pairs note-on and note-off messages into musical notes with names, start times, durations, channels, and velocities. **Events** preserves the ordered MIDI event stream for each track, including raw note messages, controller changes, program changes, pitch bends, SysEx, and meta events. **Summary** returns counts and headline timing fields for a quick inspection.

</details>

<details>
<summary>Does this render MIDI audio or identify instruments by name?</summary>

No. MIDI is symbolic performance data, not audio. This tool parses the data into JSON and reports program-change numbers, but it does not synthesize audio and does not bundle a General MIDI instrument-name table.

</details>

<details>
<summary>Why did my file fail with a missing MThd header?</summary>

The parser expects a Standard MIDI File whose first chunk is `MThd`. Some containers wrap MIDI data in another format, and some music apps save project/session files that are not SMF files. Export the sequence as `.mid` or `.midi`, then encode those bytes as base64 or hex.

</details>

## Related tools

- [Amazon Order Analyzer](https://gizza.ai/tools/amazon-order-analyzer/): Paste an Amazon order-history CSV export to summarize total spend by month, top items, and category breakdowns. Browser-only, private, with Markdown or JSON output.
- [Avro to JSON Converter](https://gizza.ai/tools/avro-to-json/): Decode Apache Avro Object Container Files (.avro / OCF) to JSON, NDJSON, or the embedded schema — no .avsc needed, free and private in your browser.
- [Reconcile bank statement and ledger CSVs](https://gizza.ai/tools/bank-statement-reconcile/): Match bank-statement CSV rows to ledger rows by date, signed amount, and fuzzy memo similarity, with unmatched and suggested matches.
- [Bencode decoder](https://gizza.ai/tools/bencode-decoder/): Decode bencode (the BitTorrent / .torrent serialization format) into readable JSON, and re-encode JSON back into canonical bencode — in your browser. Nothing is uploaded.
- [Budget Planner](https://gizza.ai/tools/budget-planner/): Plan a monthly budget from take-home pay: 50/30/20 needs/wants/savings targets with custom splits, or a zero-based plan showing what's left to allocate.
