Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Text To Speech
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Rene
(46 posts) Bio
|
Date
| Mon 25 Dec 2017 10:24 PM (UTC) Amended on Mon 25 Dec 2017 11:23 PM (UTC) by Nick Gammon
|
Message
| I've been playing with the text to speech code:
assert (package.loadlib ("luacom.dll","luacom_open")) ()
talk = assert (luacom.CreateObject ("SAPI.SpVoice"), "cannot open SAPI")
talk:Speak ("%1!")
I use it to announce events I want to hear even while in a different window, yet I find it lags MUSH on me, has anyone had similar experiences and might have a suggestion how to avoid this? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 25 Dec 2017 11:25 PM (UTC) |
Message
| Don't create the object each time, that would be slow. Create the SAPI object ("talk") once when you start the client, and just do talk:Speak when you want to say something. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Mon 25 Dec 2017 11:26 PM (UTC) |
Message
| You could probably do this:
if not talk then -- load if not already loaded
assert (package.loadlib ("luacom.dll","luacom_open")) ()
talk = assert (luacom.CreateObject ("SAPI.SpVoice"), "cannot open SAPI")
end -- if not loaded
talk:Speak ("%1!")
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
11,735 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top