| Crates.io | bevy_midi_params |
| lib.rs | bevy_midi_params |
| version | 0.1.0 |
| created_at | 2025-09-05 14:21:09.46212+00 |
| updated_at | 2025-09-05 14:21:09.46212+00 |
| description | Hardware MIDI controller integration for live parameter tweaking in Bevy games |
| homepage | https://github.com/Alex-Gilbert/bevy_midi_params |
| repository | https://github.com/Alex-Gilbert/bevy_midi_params |
| max_upload_size | |
| id | 1825629 |
| size | 157,227 |
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.
#[derive(MidiParams)] and #[midi(cc, range)] attributes[dependencies]
bevy = "0.16"
bevy_midi_params = "0.1"
use bevy::prelude::*;
use bevy_midi_params::prelude::*;
#[derive(Resource, MidiParams)]
struct GameSettings {
#[midi(1, 0.0..1.0)] // Knob 1: Player speed
pub player_speed: f32,
#[midi(2, 0.0..20.0)] // Knob 2: Gravity strength
pub gravity: f32,
#[midi(3, -1.0..1.0)] // Knob 3: Camera shake
pub camera_shake: f32,
#[midi(33)] // Button 1: Enable debug mode
pub debug_mode: bool,
}
impl Default for GameSettings {
fn default() -> Self {
Self {
player_speed: 5.0,
gravity: 9.81,
camera_shake: 0.0,
debug_mode: false,
}
}
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(MidiParamsPlugin::default())
.run();
}
That's it! Your parameters now:
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:
# Ubuntu/Debian
sudo apt install alsa-utils
# macOS (via Homebrew)
brew install alsa-utils
aseqdump -l
20:0 with your controller's port):
aseqdump -p 20:0
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
#[midi(CC, range)]Once you've found your controller's CC numbers with aseqdump, use them in your code:
#[derive(Resource, MidiParams)]
struct MyControls {
#[midi(1, 0.0..10.0)] // CC 1 from aseqdump
pub speed: f32,
#[midi(7, 0.0..1.0)] // CC 7 from aseqdump
pub volume: f32,
#[midi(64)] // CC 64 button from aseqdump
pub enabled: bool,
}
// Default - uses first available controller
App::new()
.add_plugins(MidiParamsPlugin::default())
.run();
// Specify controller name (partial match)
App::new()
.add_plugins(MidiParamsPlugin::new().with_controller("Launch Control"))
.run();
// Custom persistence file
App::new()
.add_plugins(MidiParamsPlugin::new().with_persist("my_settings.ron"))
.run();
// Chain multiple options
App::new()
.add_plugins(
MidiParamsPlugin::new()
.with_controller("BCR2000")
.with_persist("bcr_settings.ron")
)
.run();
[dependencies]
bevy_midi_params = { version = "0.1", default-features = false }
MidiParams on your structs#[midi(cc, range)]bevy_midi_params uses:
No reflection needed, no manual registration, no boilerplate!
bevy-inspector-egui - Use both for maximum flexibility| bevy_midi_params | Bevy |
|---|---|
| 0.1 | 0.16 |
Contributions welcome! This crate is designed to be:
Licensed under either of:
at your option.
Made with ❤️ for the Bevy community. Perfect your parameters, ship faster games.