def sound_play_test_sound_and_note_mixed(): n = Note('A') s = Sound(TEST_SOUND) n.play(duration=None) s.play() s.wait() n.stop() return True
def sound_sound_volume(): '''The long test sound will play for 10 second with increasing volume. ''' master_volume(100) s = Sound(TEST_SOUND_LONG) s.volume = 0 s.play(duration=10) for i in range(20): s.volume += 15 time.sleep(0.5) s.wait()
def sound_short_latency(): s = Sound(TEST_SOUND) s.stop() start = time.time() s.play() s.wait() duration = time.time() - start latency = duration - TEST_SOUND_LENGTH print("Latency: ", latency) return latency > 0 and latency < 0.050
def sound_get_set_volume(): # Verify Sound volume attribute can be get/set. s = Sound(TEST_SOUND_LONG) s.volume = 0 s.play(duration=0.5) for i in range(10): s.volume += 10 time.sleep(0.05) s.wait() return s.volume == 100
def sound_manual_play_test_sound_and_note_mixed(): '''The sound match1.wav will play TWO TIMES on the speaker, mixed with an 'A' note. ''' n = Note('A') s = Sound(TEST_SOUND) n.play(duration=None) s.play() s.wait() s.play() s.wait() n.stop()
def sound_play_test_sound_loop_2(): '''The sound match1.wav will play TWO TIMES on the speaker (about 0.5 seconds each).''' s = Sound(TEST_SOUND) s.play(loops=2) s.wait()
def sound_play_test_sound(): '''The sound match1.wav will play on the speaker (about 0.5 seconds).''' s = Sound(TEST_SOUND) s.play() s.wait()
def sound_wait(): s = Sound(TEST_SOUND) s.play() s.wait() return not s.is_playing()