MIDI convert (MIDI2TŒRN)
Live: https://toern.live/tools/convertmidi/
Source: tools/convertmidi/ (Vite + React app in app/)
What it does
- Import a
.midfile (@tonejs/midi) - Map notes onto the TŒRN grid (pages × steps × rows / voices)
- Preview playback in the browser (Tone.js)
- Tune BPM, subdivision, track enable, overlap filtering, transpose / note priority
- Export a
pattern_page_N.txtbinary-ish blob matching the firmware’s note table layout (channel,velocity, …) for the current page
Voice / pitch mapping follows device conventions (documented in app/src/utils/midiParser.ts — e.g. voice 1 row relationships to MIDI note numbers).
Code map
| Path | Role |
|---|---|
app/src/App.tsx | Shell, upload, page state |
app/src/utils/midiParser.ts | Parse MIDI → grid notes |
app/src/components/NoteGrid.tsx | Grid UI + pattern export bytes |
app/src/components/PatternDownload.tsx | Download control |
assets/ | Built static assets for the site path /tools/convertmidi/ |
Local development
cd tools/convertmidi/app
npm install
npm run dev
Production build (used by the website tool path):
cd tools/convertmidi/app
npm run build
website/package.json runs this as part of build:convertmidi when building the main site.