简单的、跨平台的 Python MIDI 库 [英] Simple, Cross Platform MIDI Library for Python

查看:26
本文介绍了简单的、跨平台的 Python MIDI 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个创建 MIDI 声音的小应用程序.我从来没有在编程中处理过声音,所以我想从一些基本的并且有很好文档的东西开始.我想坚持使用 Python,因为我最习惯使用 Python,并且一开始不想让自己不知所措.

我的时间在 Windows 和 Ubuntu 之间分配了大约 50/50,所以在这两个平台上正常工作"的东西会非常有帮助.

有什么建议吗?

解决方案

MIDIUtil 库(托管在 此处 at Google Code)做你想做的事:从纯 Python 库编写 MIDI 文件.关于它的一个好处(并且完全披露:我是作者)是您不必跟踪较低级别的 MID 事件,例如 note-on 和 note-off:它会为您处理它们.

以写笔记为例,您可以执行以下操作:

MyMIDI = MIDIFile(1)轨道 = 0频道 = 0间距 = 60时间 = 0持续时间 = 1体积 = 100MyMIDI.addNote(track,channel,pitch,time,duration,volume)

希望能帮到你

I want to do build a small app that creates MIDI sounds. I've never dealt with sound in programming so I'd like to start with something that's basic and has good documentation. I want to stick with Python since I'm the most comfortable with it and don't want to overwhelm myself, initially.

My time is split about 50/50 between Windows and Ubuntu so something that "just works" on both platforms would be really helpful.

Any suggestions?

解决方案

The MIDIUtil Library (hosted here at Google Code) does what you want: write MIDI Files from a pure Python library. Once nice thing about it (and full disclosure: I'm the author) is that you don't have to keep track of lower-level MID events such as note-on and note-off: it handles them for you.

As an example to write a note, you would do something like:

MyMIDI = MIDIFile(1)
track = 0
channel = 0
pitch = 60
time = 0
duration = 1
volume = 100
MyMIDI.addNote(track,channel,pitch,time,duration,volume)

Hope this helps

这篇关于简单的、跨平台的 Python MIDI 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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