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, '}'
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')
def int_to_user_octave_notename(i): return MusicalPitch.new_from_int(i).get_user_octave_notename()
def test_add_interval_fail(self): n = MusicalPitch.new_from_int(120) i = Interval("M10") self.assertRaises(ValueError, lambda: n + i)
def test_add_integer_fail(self): n = MusicalPitch.new_from_int(120) self.assertRaises(ValueError, lambda: n + 20)