本文整理汇总了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, '}'
示例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')
示例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()
示例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)
示例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)