A Flutter plugin to play midi on iOS and Android uses SoundFont (.sf2) files.
This plugin is still under development. Android code is based on fluidsynth, iOS version is based on build-in iOS AudioUnit and flutter package flutter_midi. Other platforms are planned.
- Add sf2 file and include it in pubspec.yaml
assets:
- assets/Piano.sf2
- Load the sound
_midiPlayer.load('assets/Piano.sf2');
- Play midi note
_midiPlayer.playNote(note: 60);
or
_midiPlayer.playNote(note: 62, velocity: 0.5);
- Dispose after usage
_midiPlayer.dispose();
-
macOS
-
Windows
-
Linux
-
Web