合成音符(钢琴的声音)在Python [英] Synthesize musical notes (with piano sounds) in Python

查看:2455
本文介绍了合成音符(钢琴的声音)在Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个乐器库的Python实现(例如,一个钢琴对象),我可以使用转换的笔记列表和持续时间为声音。例如,是这样的:

I would like to have a python implementation of a musical instrument library (for instance, a piano object) that I can use to convert a list of notes and a duration into sound. For instance, something like:

import Piano

pn = Piano()
pn.play([note, note, ..., note], duration)

对于是否Python 2.7版这样的事情存在吗?我想如果没有实现它。我现在有一些使用audiere,但它只是正弦波所以它听起来太可怕了。有什么办法挂接到一个midi钢琴或类似但─我使用Windows 7的东西吗?是否有任何执行措施,我可能不希望?

Does something like this exist for python 2.7? I would like to implement it if it doesn't. I currently have something that uses audiere, but its just sine waves so it sounds horrible. Is there any way to hook into a midi piano or something like that- I am using windows 7? Are there any implementing steps that I might not expect?

推荐答案

@Marcelos答案的一个子集: HTTP: //$c$c.google.com/p/mingus/

A subset of @Marcelos answer: http://code.google.com/p/mingus/

明格斯是用于程序员,音乐家,作曲家和研究人员进行调查和音乐包为Python。 是在明格斯的核心是音乐理论,其中包括主题像间隔,和弦,音阶和级数

mingus is a package for Python used by programmers, musicians, composers and researchers to make and investigate music. At the core of mingus is music theory, which includes topics like intervals, chords, scales and progressions.

的MIDI包可以保存和载入MIDI文件,-last但不least-为所有容器和FluidSynth序子类通用序。 这可以让你在短短的几行的直接播放你所有的数据结构在Python。大多数恶心时机和MIDI code已经被抽象掉你,留下一个干净的,相对简单的API。

The MIDI package can save and load MIDI files, and -last but not least- provides a general purpose sequencer for all the containers and a FluidSynth sequencer subclass. This allows you to play all your data structures straight from Python in just a couple of lines. Most of the icky timing and MIDI code has been abstracted away for you, leaving a clean, relatively simple API.

这篇关于合成音符(钢琴的声音)在Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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