基于COCHONUT做和弦识别
论文为:COCHONUT: Recognizing Complex Chords From MIDI Guitar Sequences
出处:international symposium/conference on music information retrieval(ISMIR) 2008
自动和弦辨别的难点:
strong context dependency and the large number of possible combinations of the intervals which the chords are made of, specially when dealing with dissonances,and suspended chords.
论文提出一个新的方法COCHONUT (Complex Chords Nutting)来识别midi guitar的和弦,基于contextual harmonic information + decision theory + optimization + pattern matching + rule-based recognition
COCHONUT的目标不仅是辨认1,3,5音,复杂音符,4音符,5音符,6音符和弦也能被辨认出来。
代码中是基于musicXML来进行解析,因此可以得到歌曲大小调标志(后续根据上下文来增强识别和弦时需要用到)
第一步,a segmentation algorithm判断出最可能的和弦变化的点,这一步做分割。主要函数
![](https://images2017.cnblogs.com/blog/1259250/201801/1259250-20180121164422037-1249336794.png)
第二步,utility function判别每个segmentation的和弦;
![](https://images2017.cnblogs.com/blog/1259250/201801/1259250-20180121171948271-799404693.png)
这里构建了一个weight权重数组(12音阶),统计出该段中的音符值次数(权重比例),将该权重数组与事先定义好的和弦template一起匹配,得到每个和弦的得分,并得出最佳得分的和弦。
templates = [{'name': 'maj', 'pattern': [0, 4, 7]},
{'name': 'minor', 'pattern': [0, 3, 7]},
{'name': 'diminished', 'pattern': [0, 3, 6]},
{'name': '-5', 'pattern': [0, 4, 6]},
{'name': 'aug', 'pattern': [0, 4, 8]},
{'name': 'sus4', 'pattern': [0, 5, 7]},
{'name': 'sus2', 'pattern': [0, 2, 7]},
{'name': 'maj7', 'pattern': [0, 4, 7, 11]},
{'name': 'maj7+5', 'pattern': [0, 4, 8, 11]},
{'name': 'dom', 'pattern': [0, 4, 7, 10]},
{'name': 'add9', 'pattern': [0, 4, 7, 14]},
{'name': '1/2dim', 'pattern': [0, 3, 6, 10]},
{'name': 'dim7', 'pattern': [0, 3, 6, 9]},
{'name': 'min7', 'pattern': [0, 3, 7, 10]},
{'name': 'min/maj7', 'pattern': [0, 3, 7, 11]},
{'name': '7+5', 'pattern': [0, 4, 8, 10]},
{'name': '7-5', 'pattern': [0, 4, 6, 10]},
{'name': '7sus4', 'pattern': [0, 5, 7, 10]},
{'name': 'maj6', 'pattern': [0, 4, 7, 9]},
{'name': 'minor6', 'pattern': [0, 3, 7, 9]},
{'name': 'madd9', 'pattern': [0, 3, 7, 14]},
{'name': 'm6/9', 'pattern': [0, 3, 7, 9, 14]},
{'name': '6add9', 'pattern': [0, 4, 7, 9, 14]},
{'name': '7/6', 'pattern': [0, 4, 7, 9, 10]},
{'name': '9', 'pattern': [0, 4, 7, 10, 14]},
{'name': '7/13', 'pattern': [0, 4, 7, 10, 21]},
{'name': '9-5', 'pattern': [0, 4, 6, 10, 14]},
{'name': '9+5', 'pattern': [0, 4, 8, 10, 14]},
{'name': 'min9', 'pattern': [0, 3, 7, 10, 14]},
{'name': '7-9', 'pattern': [0, 4, 7, 10, 13]},
{'name': '7+9', 'pattern': [0, 4, 7, 10, 15]},
{'name': 'maj9', 'pattern': [0, 4, 7, 11, 14]},
{'name': 'min/maj9', 'pattern': [0, 3, 7, 11, 14]},
{'name': '9/6', 'pattern': [0, 4, 7, 9, 10, 14]},
{'name': 'maj11', 'pattern': [0, 4, 7, 11, 14, 17]},
{'name': '9+11', 'pattern': [0, 4, 7, 10, 14, 18]},
{'name': '11', 'pattern': [0, 4, 7, 10, 14, 17]},
{'name': '11-9', 'pattern': [0, 4, 7, 10, 13, 17]},
{'name': 'aug11', 'pattern': [0, 4, 7, 10, 14, 18]},
{'name': 'min11', 'pattern': [0, 3, 7, 10, 14, 17]},
{'name': 'min13', 'pattern': [0, 3, 7, 10, 14, 17, 21]},
{'name': 'maj13', 'pattern': [0, 4, 7, 11, 14, 17, 21]},
{'name': '13', 'pattern': [0, 4, 7, 10, 14, 17, 21]},
{'name': '13-9', 'pattern': [0, 4, 7, 10, 13, 17, 21]},
{'name': '13-9-6', 'pattern': [0, 4, 6, 10, 13, 17, 21]},
{'name': '13-9+11', 'pattern': [0, 4, 7, 10, 13, 18, 21]},
{'name': '13+11', 'pattern': [0, 4, 7, 10, 14, 18, 21]},
{'name': '13b', 'pattern': [0, 4, 7, 10, 14, 17, 20]}]
![](https://images2017.cnblogs.com/blog/1259250/201801/1259250-20180121172745193-483970955.png)
接下来,把前后相关的segments和调式一起结合起来,从上下文的角度来增强和弦挑选的准确性。
大调和小调的区别处理
事先定义好的和弦走向转换图
第三步,graph is built表示出最可能的和弦整体图,A rule base containing common chord sequences patterns in jazz harmony is used to solve ambiguous cases.