Python Forum
pyttsx3 cutting off last word
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pyttsx3 cutting off last word
#4
(Feb-28-2022, 10:33 PM)Extra Wrote: I have one other question though. Is it possible to have my speech output run as the text is being displayed on the screen (through the auto-type/typewriter animation). Right now the text will "typewrite" to the screen, then the speech output will start. Is there anyway the can work simultaneously?
This would be my best shot at that.
import sys
import time
import pyttsx3
import threading

engine = pyttsx3.init ()
engine.setProperty ('rate', 120)

def tell (*output_array) :
	output_string = ' '.join (output_array)
	engine.say (output_string)
	engine.runAndWait ()

def show_and_tell (output_string) :
		output_array = output_string.split ()
		telling = threading.Thread (target = tell, args = (output_array))
		telling.start ()
		for letter in output_string :
			print (letter, end = '')
			sys.stdout.flush ()
			time.sleep (0.08)
		print ()

show_and_tell ('How may I be of service?')
Reply


Messages In This Thread
pyttsx3 cutting off last word - by Extra - Feb-28-2022, 10:02 PM
RE: pyttsx3 cutting off last word - by BashBedlam - Feb-28-2022, 10:12 PM
RE: pyttsx3 cutting off last word - by Extra - Feb-28-2022, 10:33 PM
RE: pyttsx3 cutting off last word - by BashBedlam - Feb-28-2022, 11:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Controlling text-to-speech pauses with pyttsx3 pmac1300 4 4,575 Mar-14-2022, 06:47 AM
Last Post: Coricoco_fr
  pyttsx3 problem Tyrel 0 1,137 Feb-05-2022, 08:53 AM
Last Post: Tyrel
  Know when the pyttsx3 engine stops talking UsualCoder 3 3,286 Aug-29-2021, 11:08 PM
Last Post: snippsat
Question Problem: Check if a list contains a word and then continue with the next word Mangono 2 2,559 Aug-12-2021, 04:25 PM
Last Post: palladium
  Input function cutting off commands at spaces. throwaway34 3 2,244 May-12-2021, 06:40 AM
Last Post: throwaway34
  working with pyttsx3 gr3yali3n 0 1,638 Nov-24-2020, 09:40 AM
Last Post: gr3yali3n
  Python Speech recognition, word by word AceScottie 6 16,102 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  Python PIL cutting off text. DreamingInsanity 3 2,610 Oct-25-2019, 09:00 AM
Last Post: DreamingInsanity
  print a word after specific word search evilcode1 8 4,934 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019
  pyttsx3 cuts off when run from py file duelistjp 4 4,127 Dec-20-2018, 04:54 PM
Last Post: DrNerdly118

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020