bevy_midi_params
Hardware MIDI controller integration for live parameter tweaking in Bevy games.
Turn knobs, see results instantly. Perfect for shader artists, gameplay programmers, and technical artists who want tactile, real-time control over their game parameters.
✨ Features
- 🎛️ Zero-boilerplate MIDI mapping - Just add
#[derive(MidiParams)]and#[midi(cc, range)]attributes - 💾 Live persistence - Parameters auto-save as you tweak them, resume exactly where you left off
- 🔥 Hot reloading - Change values with hardware controllers while your game runs
- 🎨 Auto-generated UI - Inspect and fine-tune with automatically created egui interfaces
- ⚡ Plug & play - Works with any MIDI controller with CC support
- 🔗 Type-safe - Full compile-time validation of CC mappings and ranges
🎮 Perfect For
- Shader development - Tweak roughness, metallic, emission in real-time
- Physics tuning - Adjust gravity, damping, forces with physical controls
- Procedural generation - Modify noise parameters, generation rules on the fly
- Audio/visual effects - Control post-processing, particle systems, lighting
- Game balancing - Rapidly iterate on gameplay parameters
🚀 Quick Start
[]
= "0.16"
= "0.1"
use *;
use *;
That's it! Your parameters now:
- ✅ Respond to MIDI controller input
- ✅ Auto-save when changed
- ✅ Load previous values on startup
- ✅ Show up in a debug UI
- ✅ Work with both hardware and UI controls
🎛️ Finding Your Controller's CC Values
To use any MIDI controller, you need to find which CC (Continuous Controller) numbers your knobs, faders, and buttons send. Use aseqdump to discover these values:
Install aseqdump (Linux/macOS)
# Ubuntu/Debian
# macOS (via Homebrew)
Find Your Controller's CC Numbers
- Connect your MIDI controller
- Run aseqdump to list MIDI ports:
- Start monitoring your controller (replace
20:0with your controller's port): - Turn knobs/move faders - you'll see output like:
Waiting for data. Press Ctrl+C to end. Source_ 20:0, Event type = 10 (Control change), Channel = 0, Control = 1, Value = 64 Source_ 20:0, Event type = 10 (Control change), Channel = 0, Control = 2, Value = 127 - Note the Control numbers - these are your CC values to use in
#[midi(CC, range)]
🎵 Using Your CC Values
Once you've found your controller's CC numbers with aseqdump, use them in your code:
🔧 Configuration
Custom Configuration
// Default - uses first available controller
new
.add_plugins
.run;
// Specify controller name (partial match)
new
.add_plugins
.run;
// Custom persistence file
new
.add_plugins
.run;
// Chain multiple options
new
.add_plugins
.run;
Disable UI (headless/release builds)
[]
= { = "0.1", = false }
🎯 Workflow
- Connect your MIDI controller
- Derive
MidiParamson your structs - Annotate fields with
#[midi(cc, range)] - Run your game
- Tweak parameters with physical knobs/faders
- Values auto-save - restart and resume exactly where you left off!
🛠️ How It Works
bevy_midi_params uses:
- Proc macros to generate MIDI mapping and UI code
- Inventory for automatic registration of MIDI types
- RON for human-readable parameter persistence
- midir for cross-platform MIDI input
- egui for optional debug UI (via bevy_egui)
No reflection needed, no manual registration, no boilerplate!
🤝 Compatible With
- ✅
bevy-inspector-egui- Use both for maximum flexibility - ✅ Hot reloading workflows
- ✅ Asset pipeline integration
- ✅ Any Bevy version 0.16+
📋 Bevy Version Compatibility
| bevy_midi_params | Bevy |
|---|---|
| 0.1 | 0.16 |
🤝 Contributing
Contributions welcome! This crate is designed to be:
- Beginner-friendly - Clear error messages, good documentation
- Extensible - Easy to add new controller types and features
- Fast - Minimal runtime overhead
Ideas for contributions:
- Additional controller presets
- Web MIDI support
- Parameter interpolation/smoothing
- MIDI learn functionality
- Integration with popular audio plugins
📄 License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.
Made with ❤️ for the Bevy community. Perfect your parameters, ship faster games.