A Flutter plugin for sending and receiving MIDI messages between Flutter and physical and virtual MIDI devices.
Wraps CoreMIDI/android.media.midi/ALSA/win32 in a thin dart/flutter layer. Supports
Transports | iOS | macos | Android | Linux | Windows |
---|---|---|---|---|---|
USB | ✓ | ✓ | ✓ | ✓ | ✓ |
BLE | ✓ | ✓ | ✓ | ✗ | ✓ |
Virtual | ✓ | ✓ | ✓ | ✗ | ✗ |
Network Session | ✓ | ✓ | ✗ | ✗ | ✗ |
platform :ios, '11.0'
This plugin is build using Swift and Kotlin on the native side, so make sure your project supports this.
Import flutter_midi_command
import 'package:flutter_midi_command/flutter_midi_command.dart';
MidiCommand().devices
which returns a list of MidiDevice
MidiCommand().startBluetoothCentral()
MidiCommand().onBluetoothStateChanged()
MidiCommand().bluetoothState()
MidiCommand().startScanningForBluetoothDevices()
MidiDevice
by calling MidiCommand.connectToDevice(selectedDevice)
MidiCommand().stopScanningForBluetoothDevices()
MidiCommand.disconnectDevice()
MidiCommand().onMidiSetupChanged
MidiCommand().onMidiDataReceived
, after which the listener will recieve inbound MIDI messages as an UInt8List of variable length.MidiCommand.sendData(data)
, where data is an UInt8List of bytes following the MIDI spec.MidiCommand
subtypes to send PC, CC, NoteOn and NoteOff messages.MidiCommand().addVirtualDevice(name: "Your Device Name")
to create a virtual MIDI destination and a virtual MIDI source. These virtual MIDI devices show up in other apps and can be used by other apps to send and receive MIDI to or from your app. The name parameter is ignored on Android and the Virtual Device is always called FlutterMIDICommand. To make this feature work on iOS, enable background audio for your app, i.e., add key UIBackgroundModes
with value audio
to your app's info.plist
file.See example folder for how to use.
For help getting started with Flutter, view our online documentation.
For help on editing plugin code, view the documentation.