A modernized Junkpile foundation for receiving native MIDI through Rust and using it to control a p5.js WebGL shader inside one Tauri v1 window.
The repository folder intentionally keeps its original name:
p5-tauri-midi-template
midirMIDI controller / virtual MIDI port
↓
Rust midir callback
↓
parse_midi()
↓
window.emit("midi-event")
↓
JavaScript mapping + parameter state
↓
p5 draw loop
↓
GLSL uniforms
npm install
npm run dev
npm install provides both the local Tauri v1 CLI and p5.js. The pre-development script copies the pinned p5 build into src/vendor/, so the app does not require a CDN at runtime.
npm run build
On macOS, bundles are generated under:
src-tauri/target/release/bundle/
| CC | Parameter |
|---|---|
| 1 | Hue |
| 2 | Zoom |
| 3 | Speed |
| 7 | Brightness |
| 10 | Distortion |
| 74 | Complexity |
Saturation and glow begin unmapped. Use MIDI learn to assign them—or replace any default mapping. The mapping is saved in local storage.
Additional messages:
Install ALSA development support before compiling:
sudo apt install libasound2-dev
Class-compliant devices and virtual WinMM ports should appear automatically.
Keyboard shortcuts:
| Key | Action |
|---|---|
| Space | Pause or resume animation |
| R | Restore visual defaults |
| F | Toggle native fullscreen |
p5-tauri-midi-template/
├── README.md
├── MODERNIZATION-NOTES.md
├── package.json
├── scripts/
│ └── sync-p5.mjs
├── src/
│ ├── index.html
│ ├── sketch.js
│ ├── styles.css
│ └── vendor/p5.min.js generated after npm install
└── src-tauri/
├── Cargo.toml
├── tauri.conf.json
└── src/main.rs
| Command | Purpose |
|---|---|
list_midi_ports |
Returns currently visible MIDI inputs |
debug_midi_ports |
Returns a human-readable native port report |
connect_midi_port_by_name |
Opens a port and begins emitting events |
disconnect_midi |
Closes the active connection |
midi_connection_name |
Reports the current connection |
toggle_fullscreen |
Controls the native Tauri window |
To add another MIDI-controlled shader parameter:
PARAMS in src/sketch.js.FRAG_SHADER.draw().cc number in the parameter specification.setParam().