I would like to know how can I play midi files on mobile app
Ive found two midi libraries, but don't see how to implement function to play midi files
https://pub.dev/packages/flutter_midi here Im using this package in my app to play sf2 audio, though I can only play single notes at the time, here is code I use to do that
class KeyPage extends StatefulWidget {
@override
_KeyPageState createState() => _KeyPageState();
}
class _KeyPageState extends State<KeyPage> {
//final _flutterMidi = FlutterMidi(); //TODO 1 check TODO 2
@override
void initState() {
if (!kIsWeb) {
load(_value);
} else {
FlutterMidi.prepare(
sf2:
null); //TODO 2 check what to do here with static issue Original line was:
// _flutterMidi.prepare(sf2: null);
}
super.initState();
}
void load(String asset) async {
print("Loading File...");
FlutterMidi.unmute();
ByteData _byte = await rootBundle.load(asset);
// 'assets/sf2/SmallTimGM6mb.sf2';
// 'assets/sf2/Piano1.sf2';
FlutterMidi.prepare(sf2: _byte, name: _value.replaceAll("assets/sf2/", ""));
}
https://pub.dev/packages/dart_midi didn't yet try this package, but from reading it I don't see function in it to play midi file, though language they use is new to me, so I guess this library does that, but I don't understand how
Thank