本文整理汇总了Python中contour.contour.Contour.reduction_algorithm方法的典型用法代码示例。如果您正苦于以下问题:Python Contour.reduction_algorithm方法的具体用法?Python Contour.reduction_algorithm怎么用?Python Contour.reduction_algorithm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类contour.contour.Contour
的用法示例。
在下文中一共展示了Contour.reduction_algorithm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: voice_contour_reduction
# 需要导入模块: from contour.contour import Contour [as 别名]
# 或者: from contour.contour.Contour import reduction_algorithm [as 别名]
def voice_contour_reduction(piece_path, voice):
"""Retorna a redução de contornos de Morris a partir de uma voz de
uma peça.
>>> voice_contour_reduction('bach/bwv7.7', 'Soprano')
[< 0 2 1 >, 4]
"""
piece = corpus.parse(piece_path)
voice_notes = piece.getElementById(voice).flat.notes
voice_freq = [n.frequency for n in voice_notes]
voice_contour = Contour(voice_freq).translation()
return voice_contour.reduction_algorithm()