在Python中读取MIDI文件 [英] Reading a MIDI file in Python

查看:552
本文介绍了在Python中读取MIDI文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够用Python从MIDI文件中读取事件.我已经在寻找库,但是在Windows中找不到与我的MIDI文件一起使用的库.我不需要实时做任何事情,只需要一个简单的库即可为我提供事件和时间.为自己写一个会更容易吗?任何帮助将不胜感激.

I want to be able to read events from a MIDI file in Python. I have looked for libraries, but can't find one that works with my MIDI file in windows. I do not need to do anything real time, and just want a simple library that gives me events and times. Would it be easier to write one for myself? Any help would be appreciated.

推荐答案

MIDI文件的结构非常简单.如果找不到现成的库(我不知道任何库),而您只需要事件和时间,则建议您尝试自己解析文件.

the structure of a midi file is quite simple. if you can't find a ready-made library (i am not aware of any) and you only need events and time, i suggest you try parsing the file yourself.

(准备进行很多位移:MIDI数据存储在7位块的字符串中)

(prepare for a lot of bit shifting: MIDI data are stored in strings of 7 bits blocks)

也,您说您找不到在Windows上与您的MIDI文件一起使用的库:MIDI文件应该是可移植的,而python也应该是可移植的,因此un * x lib应该在Windows上同样可以正常工作(或开发人员错过了MIDI和python的意义.

also, you say that you can't find a library which works with your MIDI file on Windows: MIDI file are supposed to be portable, and python too, so a un*x lib should work equally well on windows (or the developper missed the point of both MIDI and python).

这篇关于在Python中读取MIDI文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆