简体   繁体   English

为Kivy在Python中播放跨平台,移动,MIDI - 这可能吗?

[英]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) . 我想在Kivy中加载和播放'.mid'MIDI文件,但主要是在移动平台(即IOS和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. 我假设,我不想深入了解基于原生C / C ++的东西的复杂性(即避免必须交叉编译,我不是经验丰富的Python开发人员),所以库很可能,需要是纯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): 我将使用我发现的一些框架开始竞标(一些需要C / C ++),我没有使用过(0,零),也许有人可以提供一些反馈(或者它们可能对更广泛的社区有用) :

BTW, it would be great if the/a MIDI library could also read the lyrics from a '.mid' file 顺便说一下,如果/ MIDI库也可以从'.mid'文件中读取歌词,那将会很棒

Python Midi libraries Python Midi库

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

I'm using Fluidsynth to give me cross-platform MIDI output. 我正在使用Fluidsynth给我跨平台的MIDI输出。 It plays MIDI files with a SoundFont module for high quality audio. 它使用SoundFont模块播放MIDI文件,以获得高质量的音频。 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. 如果您对LGPL许可证感到满意,可以从pyFluidSynth( https://code.google.com/p/pyfluidsynth )获取Python绑定,但使用标准Python ctypes编写自己的绑定模块非常简单模块。

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. 通常,您需要从提供的源代码编译(并因此交叉编译)Fluidsynth,但是您可以从另一个项目中获取预编译版本,例如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. 这就是我现在正在做的事情,我将切换到编译Fluidsynth一次(如果)我正在进行的项目接近完成。

If you want to process MIDI files, eg to extract the lyrics, take a look at Mido ( https://mido.readthedocs.org/en/latest ). 如果你想处理MIDI文件,例如提取歌词,请看看Mido( https://mido.readthedocs.org/en/latest )。 I've found it very useful for reading/writing MIDI files. 我发现它对于读/写MIDI文件非常有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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