def draw(self): global start_t global tlist, ptr, plist global flist global doblock global lan1 global wait if speech.is_speaking(): self.lastt = time.time() else: if doblock: if len(self.children) < 2: k = 1 j = 1 for t in first: # print("t=",t,self.size) self.s2 = SpriteNode(t) rat = self.size.y / self.s2.size.y rat = rat * 0.1 self.s2.size = self.s2.size * rat self.s2.position = [ self.size.x * k / 9, self.size.y * j / 5 ] self.s2.position = [ self.size.x * (k / 9.), self.size.y * (1.1 - j / 5.) ] # self.s2.position[0]=200 # self.s2.position.y=self.size.y*random.random() # print(self.s2.position) k = k + 1 if (k == 8): k = 1 j = j + .75 self.add_child(self.s2) return if ptr >= len(plist) and not ( speech.is_speaking()) and time.time() > self.lastt + 5.0: startit() if ptr < len(plist) and time.time() > self.lastt + 1.5: self.s2 = None p = os.getcwd() + "/" + plist[ptr].strip() + ".png" # print(p) self.s2 = SpriteNode(p) self.s2.position = self.size / 2 rat = self.size.y / self.s2.size.y self.s2.size = self.s2.size * rat self.add_child(self.s2) if ptr == 0: sleep(wait) if (len(self.children) > 1): self.children[0].remove_from_parent() # print(p,tlist[ptr]) speech.say(tlist[ptr], lan1) # self.touch_began(xy) ptr = ptr + 1
def speak_scripture(sender): if speech.is_speaking(): speech.stop() else: speech.say(contents.text)
def say_eng_wait(eng, t=0): say(eng, 'en-GB') while is_speaking(): sleep(0.1) if speech_available: sleep(t)
def say_jap_wait(jap, t=0): say(jap, 'ja-JP', 0.3) while is_speaking(): sleep(0.1) if speech_available: sleep(t)
def finish_speaking(): # Block until speech synthesis has finished while is_speaking(): sleep(0.1)
async def speaking(self, instance, async_lib): while True: await self.speaking.write(value=[speech.is_speaking()]) await async_lib.library.sleep(0.1)
utterance.useCompactVoice = False utterance.voice = voice synthesizer.speakUtterance_(utterance) del utterance if __name__ == "__main__": my_say("Are you talkin' to me?") import time time.sleep(2) my_say("Sprichst du mit mir?", "de-DE") time.sleep(2) my_say("Sprichst du mit mir?", "junk") time.sleep(2) my_say("Are you talkin' to me?", rate=0.2) time.sleep(4) import speech speech.say("Are you talkin' to me?") while speech.is_speaking(): time.sleep(0.1) speech.say("Sprichst du mit mir?", "de-DE") while speech.is_speaking(): time.sleep(0.1) speech.say("Are you talkin' to me?", "", 0.2)
def finish_speaking(): while speech.is_speaking(): time.sleep(0.5)