def click_on_interval(self, mouse_button, interval, midi_int): if mouse_button in (1, self.keyboard_accel): # Do nothing if the user clicks on the anwer buttons or on # another input widget before the test has started. if solfege.app.m_test_mode and self.m_t.q_status == self.QSTATUS_NO: self.g_flashbar.flash(_("Click 'Start test' to begin.")) return # we have to ignore intervals greater than tenth, because # the statistics viewer can't handle it. It is no big deal # to fix it, but then the statistics can become almost unreadable # because of so many intervals. if not (mpd.interval.min_interval < interval <= mpd.interval.max_interval): self.g_flashbar.flash( _("Ignoring intervals greater than double octave.")) self.g_input.forget_last_tone() return if self.m_t.q_status == self.QSTATUS_NO: self.g_flashbar.flash(_("Click 'New interval' to begin.")) return if self.m_t.q_status == self.QSTATUS_SOLVED: if self.m_t.guess_answer(interval): self.g_flashbar.flash( _("Correct, but you have already solved this question") ) else: self.g_flashbar.flash( _("Wrong, but you have already solved this question")) elif self.m_t.q_status in (self.QSTATUS_NEW, self.QSTATUS_WRONG): if self.m_t.guess_answer(interval): self.g_flashbar.flash(_("Correct")) self.std_buttons_answer_correct() else: self.g_flashbar.flash(_("Wrong")) self.std_buttons_answer_wrong() if self.get_bool( "config/auto_repeat_question_if_wrong_answer"): self.m_t.play_question() self.g_input.set_first_note(self.m_t.m_tonika) elif mouse_button == 2: # we only get here if you use one if the instrument widgets, not # with the buttons interface. # We call new_2_tracks here, because then t2 will have the # instrument and velocity of the highest tone. t1, t2 = utils.new_2_tracks() t2.note(4, midi_int) soundcard.synth.play_track(t2) elif mouse_button == 3 and self.m_t.q_status != self.QSTATUS_NO: t1, t2 = utils.new_2_tracks() t1.note(4, self.m_t.m_tonika.semitone_pitch()) t2.note(4, (self.m_t.m_tonika + interval).semitone_pitch()) soundcard.synth.play_track(t1, t2)
def click_on_interval(self, mouse_button, interval, midi_int): if mouse_button in (1, self.keyboard_accel): # Do nothing if the user clicks on the anwer buttons or on # another input widget before the test has started. if solfege.app.m_test_mode and self.m_t.q_status == self.QSTATUS_NO: self.g_flashbar.flash(_("Click 'Start test' to begin.")) return # we have to ignore intervals greater than tenth, because # the statistics viewer can't handle it. It is no big deal # to fix it, but then the statistics can become almost unreadable # because of so many intervals. if not (mpd.interval.min_interval < interval <= mpd.interval.max_interval): self.g_flashbar.flash(_("Ignoring intervals greater than double octave.")) self.g_input.forget_last_tone() return if self.m_t.q_status == self.QSTATUS_NO: self.g_flashbar.flash(_("Click 'New interval' to begin.")) return if self.m_t.q_status == self.QSTATUS_SOLVED: if self.m_t.guess_answer(interval): self.g_flashbar.flash(_("Correct, but you have already solved this question")) else: self.g_flashbar.flash(_("Wrong, but you have already solved this question")) elif self.m_t.q_status in (self.QSTATUS_NEW, self.QSTATUS_WRONG): if self.m_t.guess_answer(interval): self.g_flashbar.flash(_("Correct")) self.std_buttons_answer_correct() else: self.g_flashbar.flash(_("Wrong")) self.std_buttons_answer_wrong() if self.get_bool("config/auto_repeat_question_if_wrong_answer"): self.m_t.play_question() self.g_input.set_first_note(self.m_t.m_tonika) elif mouse_button == 2: # we only get here if you use one if the instrument widgets, not # with the buttons interface. # We call new_2_tracks here, because then t2 will have the # instrument and velocity of the highest tone. t1, t2 = utils.new_2_tracks() t2.note(4, midi_int) soundcard.synth.play_track(t2) elif mouse_button == 3 and self.m_t.q_status != self.QSTATUS_NO: t1, t2 = utils.new_2_tracks() t1.note(4, self.m_t.m_tonika.semitone_pitch()) t2.note(4, (self.m_t.m_tonika + interval).semitone_pitch()) soundcard.synth.play_track(t1, t2)
def play_melodic(self): if self.q_status == self.QSTATUS_NO: return t1, t2 = utils.new_2_tracks() t1.note(4, self.m_tonika.semitone_pitch()) t2.note(4, 0, 0) t2.note(4, (self.m_tonika + self.m_interval).semitone_pitch()) soundcard.synth.play_track(t1, t2)
def play_question(self): if self.q_status == self.QSTATUS_NO: return low_tone = self.m_tonika.semitone_pitch() high_tone = (self.m_tonika+self.m_interval).semitone_pitch() t1, t2 = utils.new_2_tracks() t1.note(4, low_tone) t2.note(4, high_tone) soundcard.synth.play_track(t1, t2) return 1
def play_question(self): if self.q_status == self.QSTATUS_NO: return low_tone = self.m_tonika.semitone_pitch() high_tone = (self.m_tonika + self.m_interval).semitone_pitch() t1, t2 = utils.new_2_tracks() t1.note(4, low_tone) t2.note(4, high_tone) soundcard.synth.play_track(t1, t2) return 1
def play_first_interval(self, w): if self.q_status == self.QSTATUS_NO: return t1, t2 = utils.new_2_tracks() if self.get_string('first_interval_type') == 'harmonic': t1.note(4, self.m_tonikas[0]) t2.note(4, self.m_tonikas[0] + self.m_intervals[0]) else: t1.note(4, self.m_tonikas[0]) t1.notelen_time(4) t2.notelen_time(4) t2.note(4, self.m_tonikas[0] + self.m_intervals[0]) soundcard.synth.play_track(t1, t2)