简体   繁体   中英

Playing cross-platform, mobile, MIDI in Python for Kivy - is this possible?

I'd like to load and play '.mid' MIDI files in Kivy but mainly on mobile platforms (ie IOS and Android) .

I'm assuming that, I don't want to get into the intricacies of native-C/C++ based stuff (ie to avoid have to cross-compile, I'm not a seasoned Python dev), so the library, most probably, would need to be pure Python.

I'll start the bidding with some Frameworks I've found (some require C/C++), I've used none (0, zero), maybe someone could offer some feedback (or they might come in useful for the wider community):

BTW, it would be great if the/a MIDI library could also read the lyrics from a '.mid' file

Python Midi libraries

http://web.mit.edu/music21
https://github.com/cuthbertLab/music21
https://code.google.com/p/midiutil <- Pure Python, no lyrics (?)
https://code.google.com/p/mingus
http://mxm.dk/products/public/pythonmidi
http://das.nasophon.de/mididings
https://github.com/vishnubob/python-midi https://gist.github.com/anonymous/202595 <- smidi.py
http://webcache.googleusercontent.com/search?q=cache%3Alarndham.net%2Fservice%2Fpys60%2Fsmidi.py
https://pypi.python.org/pypi/midi <- C for Alsa (!)
http://www.fluidsynth.org <- For pypi midi http://sourceforge.net/p/fluidsynth <- C based

I'm using Fluidsynth to give me cross-platform MIDI output. It plays MIDI files with a SoundFont module for high quality audio. If you're happy with the LGPL licence, you can get Python bindings for it from pyFluidSynth ( https://code.google.com/p/pyfluidsynth ), but it's pretty straightforward to write your own bindings module using the standard Python ctypes module.

Normally, you would be expected to compile (and thus cross-compile) Fluidsynth from the supplied sources, however you can just take a pre-compiled version from another project, for instance MuseScore. This is what I'm doing for the moment, I'll switch to compiling Fluidsynth once (and if) the project I'm working on gets close to completion.

If you want to process MIDI files, eg to extract the lyrics, take a look at Mido ( https://mido.readthedocs.org/en/latest ). I've found it very useful for reading/writing MIDI files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM