是否有一个算法,从一系列的音符得到一首歌曲的规模和重点? [英] Is there an algorithm to get the Scale and Key of a song from a series of notes?

查看:192
本文介绍了是否有一个算法,从一系列的音符得到一首歌曲的规模和重点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列的存储阵列中的MIDI音符编号的形式MIDI音符。是否有一个算法,将让我通过这些笔记psented歌曲重新$ P $的关键和规模?

I've got a series of MIDI notes stored in array in the form of MIDI note number. Is there an algorithm that would get me the key and scale of the song represented by these notes?

推荐答案

如果您正在使用Python,你可以使用music21工具包来做到这一点:

If you're using Python you can use the music21 toolkit to do this:

import music21
score = music21.converter.parse('filename.mid')
key = score.analyze('key')
print key.tonic.name, key.mode

如果你关心的主要发现特定的算法,可以使用通用的关键的他们,而不是:

if you care about specific algorithms for key finding, you can use them instead of the generic "key":

key1 = score.analyze('Krumhansl')
key2 = score.analyze('AardenEssen')

等。所有这些方法会为和弦也。 (免责声明:music21是我的项目,所以我当然在促进它的既得利益,但你可以看看music21.analysis.discrete模块采取从那里的想法为其他项目/语言。如果你有一个MIDI分析器,该Krumhansl算法并不难实现)。

etc. Any of these methods will work for chords also. (Disclaimer: music21 is my project, so of course I have a vested interest in promoting it; but you can look at the music21.analysis.discrete module to take ideas from there for other projects/languages. If you have a MIDI parser, the Krumhansl algorithm is not hard to implement).

这篇关于是否有一个算法,从一系列的音符得到一首歌曲的规模和重点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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