Speech

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Speech

Post by Pako » Mon Mar 09, 2015 6:03 pm

This is the official topic to support Speech plugin.
I've added some new features to this plugin:
  • Added event after speaking finished
  • {DATE} context is working properly
  • Added option for selection of output device
You can try it out. Adjusted plugin can be downloaded from the SVN repository.

Pako

OklahomaGreyBeard
Posts: 6
Joined: Sun Mar 29, 2015 12:35 pm

Re: Speech

Post by OklahomaGreyBeard » Mon Apr 20, 2015 1:03 pm

Just starting to use the tts in eg. Is there a way to change the output of {TIME} to not include the seconds? I'd rather have it say "it's currently 12:42 PM." rather than "it's currently 12:42 and 17 seconds PM" (I also had a wired one while testing last night, it said "it's ten hundred PM" when I happened to run it at exactly ten o'clock.

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Speech

Post by Pako » Mon Apr 20, 2015 3:24 pm

OklahomaGreyBeard wrote:Is there a way to change the output of {TIME} to not include the seconds?
Of course, there is some possibility.
You can try it out. Adjusted plugin can be downloaded from the SVN repository.
Pako

kalia
Experienced User
Posts: 109
Joined: Wed Aug 12, 2009 1:10 am

Re: Speech

Post by kalia » Wed May 13, 2015 5:17 am

I am now back to using the Speech plugin on Window 7 64bit running Eventghost version 0.4.1 r1700.

I added additional voices using the following tutorial (https://forums.robertsspaceindustries.c ... n7-8-64bit).

I can see the additional voices in the Speech macro, but the following error comes up when I try to use the additional voices.

Code: Select all

Exception in thread Thread-1520:
Traceback (most recent call last):
  File "threading.pyc", line 532, in __bootstrap_inner
  File "C:\Program Files (x86)\EventGhost\plugins\Speech\__init__.py", line 218, in run
    tts.Speak(self.text,0)
  File "<COMObject SAPI.SpVoice>", line 3, in Speak
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147221164), None)
Again, the error only occurs when I use the additional voices.

Thanks,

Kalia
Attachments
Capture.PNG
Additional Voices

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Speech

Post by Pako » Wed May 13, 2015 4:35 pm

kalia wrote:I added additional voices using the following tutorial (https://forums.robertsspaceindustries.c ... n7-8-64bit).
I can see the additional voices in the Speech macro, but the following error comes up when I try to use the additional voices.
I'm sorry, but I do not intend to make any non-standard acts, such as editing the registry. For this reason, I have no option to work to fix the problem.

Pako

techoguy
Experienced User
Posts: 157
Joined: Mon Mar 18, 2013 1:32 am

Re: Speech

Post by techoguy » Mon Sep 07, 2015 2:41 am

Hi Pako,
Do you know if one of the output sources can be to a .wav file instead of actually playing it outloud on the speakers?
This would be useful for the SONOS plugin.

I'm about to add a TTS to .wav feature to the plugin but if I can use your plugin I rather do that instead of doing something new.

Thanks for the help!
The Latest SONOS Plugin:
Latest version can be found here: http://eventghost.org/forum/viewtopic.p ... 05f#p30309

EventGhost Lets me automate my home the way I want it, I love using it!

tameion
Posts: 20
Joined: Sat Nov 22, 2014 8:08 am
Location: New Zealand

Re: Speech

Post by tameion » Sat Mar 05, 2016 7:22 am

[MOVED FROM GENERAL DISCUSSION THREAD TO THIS PLUGIN SPECIFIC THREAD]

Hi Team

I tried using the suffix box in the standard speech plugin.
Now I keep getting the error message below when the speech has finished.

I have tried deleting the plugin from the EVENTGHOST plugins folder and then reinstalling EventGhost
I have tried the action with the suffix box filled and empty
I have tried changing voice files.
But nothing seems to fix the problem.
The error is always the same
21:58:58 Exception in thread Thread-2005:
21:58:58 Traceback (most recent call last):
21:58:58 File "threading.pyc", line 532, in __bootstrap_inner
21:58:58 File "C:\PROGRA~2\EVENTG~1\plugins\Speech\__init__.py", line 222, in run
21:58:58 self.plugin.text.suffix,
21:58:58 AttributeError: class EmptyDefaultText has no attribute 'suffix'
I cannot delete the plugin within EVENTGHOST as I have far too many related actions

Any suggestions?

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Speech

Post by Pako » Sat Mar 05, 2016 9:04 am

This is a bug.
Please download the corrected plugin here.

Pako
You know flattr ? You can Image

tameion
Posts: 20
Joined: Sat Nov 22, 2014 8:08 am
Location: New Zealand

Re: Speech

Post by tameion » Sun Mar 06, 2016 2:25 am

Awesome thanks Pako.... Worked perfectly.
I really appreciate your hard work on our behalf.

- Wayne (@Tameion)

cobraman44
Posts: 12
Joined: Mon Oct 09, 2017 6:27 pm

Re: Speech

Post by cobraman44 » Mon Oct 16, 2017 11:32 am

Getting this error when the plugin play a voice. The voice plays successfully but just wanted to report the error. Searched and could not find a fix.
Windows 10 pro 64 bit
EG 0.4.1.r1722
Exception in thread Thread-19:
Traceback (most recent call last):
File "threading.pyc", line 532, in __bootstrap_inner
File "C:\Program Files (x86)\EventGhost\plugins\Speech\__init__.py", line 220, in run
tts.Speak(self.text,0)
File "<COMObject SAPI.SpVoice>", line 3, in Speak
com_error: (-2147352567, 'Exception occurred.', (0, None, u"SSML input not valid; cannot find 'speak' element.", None, 0, -2147200925), None)

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Speech

Post by kgschlosser » Thu Oct 19, 2017 7:01 am

this problem has been fixed in EG 0.5 along with many other issues that came up with Windows 10
If you like the work I have been doing then feel free to Image

wawa79
Posts: 25
Joined: Fri Nov 02, 2012 11:01 pm

Re: Speech

Post by wawa79 » Sun Nov 19, 2017 10:09 pm

it would be nice to have an option in the Speak action to choose between queing the speech to the on-going speech (this is the current behaviour) or to interrrupt the on-going speech to speak the new text.

This can be useful when handling different speech priorities.

I made a dirty change to Speech v2.2 plugin so you can see the idea but I am not a Python expert so I am not able to implement it in the latest 2.6 version. Attached the v2.2 that I modified if it can be of any help :wink:
Attachments
__init__.py
(21.31 KiB) Downloaded 152 times

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Speech

Post by kgschlosser » Mon Nov 20, 2017 3:44 am

I see what ya did here.

I do not use this plugin at all. So I do not know what the original plugin does when you have it speak 2 times.
Does it speak one right over he other?
Does it stop the one then play the other?
Does it play one after the other with or without a pause?


I am thinking we can add some options to it so that the user can specify a default wait time between spoken phrases. I do not know if this is needed or not. If 2 phrases spoken seem like run on sentences this would fix that.

and In the action we could add several options. one being to jump to the head of the line. so as soon as the currently playing phrase (if there is one) ends then it will go. And another option to stop the currently playing phrase and play the one that was just sent in. In addition to the last option maybe to continue where the paused/stopped one left off after the "priority" one has finished.

To do any of the above we would need to institute a speech thread handler thread. so that handler would keep looping to see if there are any in the queue. and if so it would play it. and if another came in it would hold onto it if it didn't have priority until the currently playing one finished. once it finished then that default wait would kick in and once passed it would play the new one. and if a priority one came in it could pause the playing one play the priority one. and if specified to continue playing the one that is paused it would.

The only issue I see with your code is the Pause of the TTS. the reason i say this is because the actual thread never gets to terminate. This consumes a couple of meg of ram per thread as well as some CPU cycles. And if the thread never ends EG is going to take a minimum of 5 seconds to shutdown. This is a real problem when you want to restart it.. you end up with 2 stuck processes. I would have to test this to see if it is the case, I would imagine it is. But i have to read up on the whole TTS API and see how it functions.

Setting up that thread handler class would not be a problem. But we need to find a way to be able to pop back and forth between the threads without getting stuck. I have to check into the Pause to see if the call is somply made and what thread it is called from does not matter. I would think that is the case as well. Because the one that is playing i do not believe simply sends the command to speak then gets released. but maybe it does.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Speech

Post by kgschlosser » Mon Nov 20, 2017 5:26 am

I have also been researching how to add other TTS voices. I have gotten the voices from the Microsoft speech platform to work. these are way better then Anna. so I think I may build into the plugin the means to download and install these voices and making the necessary modifications to make them work properly.
If you like the work I have been doing then feel free to Image

wawa79
Posts: 25
Joined: Fri Nov 02, 2012 11:01 pm

Re: Speech

Post by wawa79 » Thu Nov 30, 2017 10:48 pm

kgschlosser wrote:
Mon Nov 20, 2017 3:44 am
I see what ya did here.

I do not use this plugin at all. So I do not know what the original plugin does when you have it speak 2 times.
Does it speak one right over he other?
Does it stop the one then play the other?
Does it play one after the other with or without a pause?
When Speech is called 2 times, the 2 phrases are spoken one after the other so the SAPI "queues" the incoming speech. What I tried to do in my code is to stop (pause) any on-going Speech before queuing a new phrase. And you are right, the thread is incorrectly handled in my code :oops. Now I understand why my PC rebooted unexpectedly time to time...

A smart way to implement the "cancel speech" behavior could be to stop on-going speech if an empty phrase is queued. This would avoid modifying the signature of the plugin methods and keeps the new version compatible.

Handling a queue in the plugin adds unnecesary complexity. It is convenient to handle priority with a queue outside the plugin with some Python script using the event that triggers at end of the Speech.

Last, pausing an on-going speech to play a higher priority speech and resuming the paused speech after is a nonsense behavior: do you ever pause your talk to say something more important and complete the initial speech after? If you do that, nobody understands you :mrgreen: :mrgreen: In such case, the paused speech should better be replay from beginning. So better leave the priorization handled outside the plugin.

Post Reply