Text To Speech

If you have a question or need help, this is the place to be.
shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Text To Speech

Post by shaggy79 » Mon Sep 28, 2015 8:58 pm

Hi all,
I recently done a clean install of windows 7 ultimate (from 32bit to 64bit) as i upgraded my RAM. Since then i cant get my TTS to work in EG?
I get the Error:
  • Traceback (most recent call last) (1700):
    File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
    return self(*args)
    File "C:\Program Files (x86)\EventGhost\plugins\Speech\__init__.py", line 194, in __call__
    voiceObj.Speak("<context>" + voiceText + "</context>", 1)
    File "<COMObject Sapi.SpVoice>", line 3, in Speak
    com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147221164), None)
Any ideas what ive done wrong ?
Cheers
Paul.

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

Re: Text To Speech

Post by kalia » Tue Sep 29, 2015 11:39 pm

Which voice are you using?

I don't think EG TTS works properly in 64 bit when using any voice except MS Anna.

I just ended up triggering an action to Start Application Nircmd?

kalia

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Wed Sep 30, 2015 1:21 am

kalia wrote:Which voice are you using?

I don't think EG TTS works properly in 64 bit when using any voice except MS Anna.

I just ended up triggering an action to Start Application Nircmd?

kalia
Hi Kalia,
Thanks for the reply.
Im using Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)
How do i "trigger an action to start an application Nircmd"?
I have no idea what "Nircmd" is or how to do it?
Any more info would be greatfully appreciated
Paul

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

Re: Text To Speech

Post by kalia » Wed Sep 30, 2015 4:05 am

Sorry was in a rush and did not get to respond properly.

I use a command line tool called Nircmd (http://www.nirsoft.net/utils/nircmd.html).

In Eventghost, use the "System" action "Start Application" to run Nircmd with the command line parameter "speak text " and the text you want spoken. It will use the default TTS settings you have set in Windows.

kalia
Attachments
Capture.PNG
Nircmd

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Thu Oct 01, 2015 12:50 am

kalia wrote:Sorry was in a rush and did not get to respond properly.

I use a command line tool called Nircmd (http://www.nirsoft.net/utils/nircmd.html).

In Eventghost, use the "System" action "Start Application" to run Nircmd with the command line parameter "speak text " and the text you want spoken. It will use the default TTS settings you have set in Windows.

kalia
No Problem... Thanks again for the reply, Here is the Python Script someone did for me in another thread..

Code: Select all

from datetime import datetime
current = datetime.now().time()
morning = current.replace(hour=6, minute=0, second=0)
afternoon = current.replace(hour=12, minute=0, second=0)
evening = current.replace(hour=17, minute=0, second=0)
if current > morning:
    if current > afternoon:
        if current > evening:
            eg.plugins.Speech.TextToSpeech(u'Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)', 0, u'Good evening Shaggy', 0, 100)
        else:
            eg.plugins.Speech.TextToSpeech(u'Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)', 0, u'Good afternoon Shaggy', 0, 100)
    else:
        eg.plugins.Speech.TextToSpeech(u'Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)', 0, u'Good morning Shaggy', 0, 100)
Will your suggestion still allow this to work?
Cheers
Paul.

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Text To Speech

Post by krambriw » Thu Oct 01, 2015 4:22 am

No, it has to be modified.

Before making too many changes, try this:

- run EventGhost as admin
- try this script using 'MIcrosoft Anna - English (United States) instead

It works in my PC (Win7 64bit)

Code: Select all

from datetime import datetime
current = datetime.now().time()
morning = current.replace(hour=6, minute=0, second=0)
afternoon = current.replace(hour=12, minute=0, second=0)
evening = current.replace(hour=17, minute=0, second=0)
if current > morning:
    if current > afternoon:
        if current > evening:
            eg.plugins.Speech.TextToSpeech(u'Microsoft Anna - English (United States)', 0, u'Good evening Shaggy', 0, 100)
        else:
            eg.plugins.Speech.TextToSpeech(u'Microsoft Anna - English (United States)', 0, u'Good afternoon Shaggy', 0, 100)
    else:
        eg.plugins.Speech.TextToSpeech(u'Microsoft Anna - English (United States)', 0, u'Good morning Shaggy', 0, 100)

Otherwise following Kalias suggestion:

The lines starting with "eg.plugins.Speech.TextToSpeech...." needs to be replaced with calls to new actions that Kalia showed you

Create those actions in EG, then right click on each, 'Copy As Python' and paste into your script

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Thu Oct 01, 2015 11:37 pm

Thank you Krambriw,

but i want the voice en GB Hazel. She sounds alot better (more natural).
I will try Kalias's suggestion if i can figure it out lol :oops:
Cheers
Paul.

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Text To Speech

Post by krambriw » Fri Oct 02, 2015 4:04 am

Well, I believe the problem you are facing is not because of EventGhost but due to that you have a new PC and need to install some more software.

If you create a Text to Speech action, look in the drop down what voices you have available? Most likely you do not see the GB Hazel because it is not installed
Skärmklipp.JPG
Check out this:
Because you're using two different TTS engines. Microsoft.Speech uses the server TTS voices; System.Speech uses the desktop TTS voices. See the discussion here.

Windows Vista and above have desktop TTS voices registered by default, but no server TTS voices. When you install the Server Speech Platform Runtime, which I believe you have to do in order to get the Microsoft.Speech.dll loaded in the first place, you should have the option to install some server TTS voices as well.
Link to the forum discussion:
http://stackoverflow.com/questions/1757 ... -speech-sy

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Fri Oct 02, 2015 5:18 pm

thanks again Krambriw,
I hav'nt had time to look at the thread you posted yet, but EN GB Hazel IS in my list.

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Sat Oct 03, 2015 10:07 pm

???
Had a look at the thread installed the speech server again but still no joy ? :cry:

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Tue Oct 27, 2015 2:10 am

@ kalia,
I tried your suggestion with "nircmd" but I still cant get it to use the voice I want (EN-GB Hazel).
I'm going to give it another try after reinstalling the software again.

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Wed Oct 28, 2015 1:02 am

Nope still same cant use the voice I want?!?!? :cry:

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

Re: Text To Speech

Post by kalia » Sat Oct 31, 2015 2:33 pm

Does the voice work in "Speech Properties" window (Control Panel > Speech Recognition > Advanced Speech Options)?

noesis
Posts: 15
Joined: Wed Feb 01, 2012 3:05 pm

Re: Text To Speech

Post by noesis » Sun Nov 01, 2015 8:47 am

Hi Shaggy79,

I also use a Microsoft Server Text to Speech Voice, and like kalia suggested, I use nircmd. I was wondering which version of nircmd you tried using (ie 64 bit or 32 bit). I have win 7 64-bit and the MS Server TTS voices (actually many various TTS voices) don't register correctly in 64 bit versions of windows from what I've read on this issue elsewhere. For me the voice doesn't even work in the native speech properties window, unless I use the 32bit version of it (which I downloaded some time ago, can't remember where from, as it doesn't come with 64bit versions of Windows).

What this means is if you used the 64 bit version of nircmd, it wouldn't have worked, but the 32bit version of nircmd should (at least that's what happens with me). In fact I have this same issue with AHK, using exactly the same script, running as 64bit, I get errors running as 32bit, no errors and works.

shaggy79
Experienced User
Posts: 129
Joined: Sun Jul 13, 2014 4:57 pm

Re: Text To Speech

Post by shaggy79 » Sun Nov 01, 2015 9:33 pm

kalia wrote:Does the voice work in "Speech Properties" window (Control Panel > Speech Recognition > Advanced Speech Options)?
Kalia,
Yes it works fine in "Speech Properties"??

Post Reply