10 releases (5 breaking)
| 0.6.1 | Aug 16, 2025 |
|---|---|
| 0.6.0 | Jun 2, 2025 |
| 0.5.0 | Apr 13, 2025 |
| 0.4.0 | Mar 9, 2025 |
| 0.1.2 | Sep 10, 2024 |
#655 in Audio
760 downloads per month
4MB
325 lines
bevy_rustysynth
A plugin which adds MIDI file and soundfont audio support to the bevy engine via rustysynth.
From version 0.4, the crate has undergone significant rewrites, and now works with the default bevy_audio backend (bevy_audio feature) OR bevy_kira_audio (kira feature)
Compatibility
| Crate Version | Bevy Version |
|---|---|
| 0.6 | 0.16 |
| 0.5 | 0.15 |
| 0.2 | 0.14 |
Installation
crates.io
[dependencies]
bevy_rustysynth = "0.6"
Usage
In main.rs:
use bevy::prelude::*;
use bevy_rustysynth::*;
fn main() {
App::new()
.add_plugins((
DefaultPlugins,
RustySynthPlugin {
soundfont: // Bring your own soundfont or enable the "hl4mgm" feature to use a terrible 4MB default
}
))
.run();
}
Then you can load and play a MIDI like any other audio file:
bevy_audio Example
let midi_handle = asset_server.load::<MidiAudio>("example.mid");
commands.spawn(AudioPlayer(midi_handle));
bevy_kira_audio Example
let midi_handle = asset_server.load::<AudioSource>("example.mid");
audio.play(midi_handle);
License
This crate is licensed under your choice of 0BSD, Apache-2.0, or MIT license.
Dependencies
~34–72MB
~1M SLoC