from rstem.accel import Accel from rstem.sound import Speech import random import time ready_tts = Speech("Ready to play?") tilt_left_tts = Speech("Tilt left!") tilt_right_tts = Speech("Tilt right!") tilt_up_tts = Speech("Tilt up!") shake_me_tts = Speech("Shake me!") no_action_tts = Speech("No action!") detect_tts = Speech("I detected:") wrong_tts = Speech("Oops!") correct_tts = Speech("Correct!") try_again_tts = Speech("Try again another time!") actions_tts = [no_action_tts, tilt_left_tts, tilt_right_tts, tilt_up_tts, shake_me_tts] for speech in [ready_tts, tilt_left_tts, tilt_right_tts, tilt_up_tts, shake_me_tts, no_action_tts, detect_tts, wrong_tts, right_tts, try_again_tts]: speech.volume = 400 accel = Accel() NOACTION = 0 LEFT = 1 RIGHT = 2 UP = 3
from rstem.accel import Accel from rstem.sound import Speech import random import time ready_tts = Speech("Ready to play?") tilt_left_tts = Speech("Tilt left!") tilt_right_tts = Speech("Tilt right!") tilt_up_tts = Speech("Tilt up!") shake_me_tts = Speech("Shake me!") no_action_tts = Speech("No action!") detect_tts = Speech("I detected:") wrong_tts = Speech("Oops!") correct_tts = Speech("Correct!") try_again_tts = Speech("Try again another time!") actions_tts = [ no_action_tts, tilt_left_tts, tilt_right_tts, tilt_up_tts, shake_me_tts ] accel = Accel() NOACTION = 0 LEFT = 1 RIGHT = 2 UP = 3 SHAKE = 4 # Ready to play?
def speech_play(): s = Speech("Test") s.play() s.wait() return True
def speech_manual_play(): '''The text "These aren't the droids you're looking for." will play on the speaker.''' s = Speech("These aren't the droids you're looking for.") s.play() s.wait()
def speech_wait_chainable(): Speech("test").wait().wait() return True
def speech_stop_chainable(): Speech("test").stop().stop() return True
def speech_play_chainable(): Speech("test").play().play() return True