当前位置: 首页>>代码示例>>Python>>正文


Python MusicalPitch.new_from_int方法代码示例

本文整理汇总了Python中solfege.mpd.musicalpitch.MusicalPitch.new_from_int方法的典型用法代码示例。如果您正苦于以下问题:Python MusicalPitch.new_from_int方法的具体用法?Python MusicalPitch.new_from_int怎么用?Python MusicalPitch.new_from_int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在solfege.mpd.musicalpitch.MusicalPitch的用法示例。


在下文中一共展示了MusicalPitch.new_from_int方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: question

# 需要导入模块: from solfege.mpd.musicalpitch import MusicalPitch [as 别名]
# 或者: from solfege.mpd.musicalpitch.MusicalPitch import new_from_int [as 别名]
def question(f, b, c):
    low = 60
    tone_a = MusicalPitch.new_from_int(low)
    tone_b = MusicalPitch.new_from_int(low + b)
    tone_c = MusicalPitch.new_from_int(low + c)
    print >> f, 'question {'
    print >> f, '  question_text = _("Sing the three tones")'
    print >> f, '  music = voice("< %s2 %s %s >")' % (
        (tone_a.get_octave_notename(),
         tone_b.get_octave_notename(),
         tone_c.get_octave_notename()))
    print >> f, '  answer = voice("%s8 %s %s")' % (
        (tone_a.get_octave_notename(),
         tone_b.get_octave_notename(),
         tone_c.get_octave_notename()))
    print >> f, '}'
开发者ID:gabrielelanaro,项目名称:solfege,代码行数:18,代码来源:generate_lessonfiles.py

示例2: question

# 需要导入模块: from solfege.mpd.musicalpitch import MusicalPitch [as 别名]
# 或者: from solfege.mpd.musicalpitch.MusicalPitch import new_from_int [as 别名]
def question(f, b, c):
    low = 60
    tone_a = MusicalPitch.new_from_int(low)
    tone_b = MusicalPitch.new_from_int(low + b)
    tone_c = MusicalPitch.new_from_int(low + c)
    f.write('question {\n')
    f.write('  question_text = _("Sing the three tones")\n')
    f.write('  music = voice("< %s2 %s %s >")\n' % (
        (tone_a.get_octave_notename(),
         tone_b.get_octave_notename(),
         tone_c.get_octave_notename())))
    f.write('  answer = voice("%s8 %s %s")\n' % (
        (tone_a.get_octave_notename(),
         tone_b.get_octave_notename(),
         tone_c.get_octave_notename())))
    f.write('}\n')
开发者ID:tcamundsen,项目名称:solfege,代码行数:18,代码来源:generate_lessonfiles.py

示例3: int_to_user_octave_notename

# 需要导入模块: from solfege.mpd.musicalpitch import MusicalPitch [as 别名]
# 或者: from solfege.mpd.musicalpitch.MusicalPitch import new_from_int [as 别名]
def int_to_user_octave_notename(i):
    return MusicalPitch.new_from_int(i).get_user_octave_notename()
开发者ID:PauloJava2016,项目名称:Solfege,代码行数:4,代码来源:mpdutils.py

示例4: test_add_interval_fail

# 需要导入模块: from solfege.mpd.musicalpitch import MusicalPitch [as 别名]
# 或者: from solfege.mpd.musicalpitch.MusicalPitch import new_from_int [as 别名]
 def test_add_interval_fail(self):
     n = MusicalPitch.new_from_int(120)
     i = Interval("M10")
     self.assertRaises(ValueError, lambda: n + i)
开发者ID:PauloJava2016,项目名称:Solfege,代码行数:6,代码来源:test_musicalpitch.py

示例5: test_add_integer_fail

# 需要导入模块: from solfege.mpd.musicalpitch import MusicalPitch [as 别名]
# 或者: from solfege.mpd.musicalpitch.MusicalPitch import new_from_int [as 别名]
 def test_add_integer_fail(self):
     n = MusicalPitch.new_from_int(120)
     self.assertRaises(ValueError, lambda: n + 20)
开发者ID:PauloJava2016,项目名称:Solfege,代码行数:5,代码来源:test_musicalpitch.py


注:本文中的solfege.mpd.musicalpitch.MusicalPitch.new_from_int方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。