Midistream#
Package to synthesize and play MIDI commands from Python for Android.
Midistream is a wrapper for Bill Farmer’s Midi Driver, and includes libmidi.so libraries from the MidiDriver build. The bundled MidiDriver components are licensed under the Apache License 2.0.
The previous version used the system Sonivox EAS library and Audiostream for playback.
Documentation: https://herethere.me/midistream
Quick start development environment#
midistream is included in PythonHere app, together with the Jupyter Notebook it could be used as a development environment.
Usage examples: https://herethere.me/examples/midi.html
Basic usage:
import time
from midistream import ReverbPreset, Synthesizer
from midistream.helpers import Note, midi_note_off, midi_note_on
midi = Synthesizer()
midi.volume = 70
midi.reverb = ReverbPreset.LARGE_HALL
midi.write(midi_note_on(Note.C4, velocity=100))
time.sleep(1)
midi.write(midi_note_off(Note.C4))
midi.close()
Build an Android app#
The following instructions are for building app with buildozer tool.
buildozer.spec requirements should include midistream:
requirements = python3,kivy,midistream
App configuration example: buildozer.spec
Examples#
See examples/ directory.
examples/demo is an app that shows how to initialize the synthesizer, inspect configuration, set volume and reverb, and play MIDI notes:
cd examples/demo
buildozer android debug deploy run logcat