Search FAQ

Gammon Forum

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.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ brief example: interfacing with jaws

brief example: interfacing with jaws

Posting of new messages is disabled at present.

Refresh page


Posted by Fastfinge   (2 posts)  Bio
Date Sat 07 Apr 2007 06:21 PM (UTC)

Amended on Sat 07 Apr 2007 06:24 PM (UTC) by Fastfinge

Message
I've noticed some recent interest in this client from the blind community; maybe it has something to do with recent audyssey postings? Anyway, several people seem to be having struggles with getting jaws for windows (screen reader from freedomscientific.com) to read out incoming text. The following is an example script to get you started; note that it has issues (mainly: if the prompt doesn't have a new line after it it won't be read out...quite annoying), this is just an example to get other folks started; I have no time and I don't particularly enjoy mudding. Sapi5 and Window Eyes support is not provided, but it could be done without much effort. You need to have jfwapi.dll correctly installed on your system (you can get it from blindprogramming.com). If you're not interested in doing some coding, I'd recommend you stick with Sean's scripts for MonkeyTerm, as the access level is much higher...for a start, mushclient can't yet (as far as I know) do soundpacks. Anyway, add the following script to your world, then run the plugin wizard (under file) and create a plugin, then go to plugins (also under file) and add the plugin you just made.

edit: pasted this, but the formatting got screwed all to hell. it's at the following link:
http://www.interfree.ca/samuelp/speak.txt
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 07 Apr 2007 09:08 PM (UTC)
Message
Here is the text:


' do stuff
dim jfw
set jfw = CreateObject("jfwapi")

sub OnPluginEnable()
jfw.SayString "plugin enabled!  ready.", 0
end sub

sub OnPluginConnect
jfw.SayString "World connected.", 0
end sub

sub OnPluginClose
jfw.SayString "goodbye.", 0
end sub

sub OnPluginDisconnect
jfw.SayString "world disconnected!", 0
end sub

sub OnPluginDisable
jfw.SayString "disabled.", 0
end sub

Function OnPluginLineReceived (sText)
jfw.SayString cStr(sText), 0
  OnPluginLineReceived = vbTrue  ' display it
End Function

' useful for triggers:
public sub saystring(string, important)
' string is the string to speak.
' important: set to 1 to stop speaking of other text and begin reading this right away.  
' set to 0 to speak this text after other reading is done.
' for example, set important to 1 to stop reading an area description when making a trigger 
' to match when an enimy enters the area
jfw.SayString string, important
end sub



There have been some other posts about speaking stuff, for example:

http://www.gammon.com.au/forum/bbshowpost.php?id=6593

http://www.gammon.com.au/forum/bbshowpost.php?id=6586


Quote:

if the prompt doesn't have a new line after it it won't be read out...quite annoying


This particular issue has been raised many times. It is related to the fact that TCP/IP is a streaming protocol, and the client has no particular way to know that an entire line (eg. a prompt line) has arrived, or has only half-arrived.

Thus trigger matching (and the speech interface) are done at line completion.

However there have been numerous work-arounds posted here. A few are:


  • Setting an option in the client to convert GA (go-ahead) - a character that some MUDs send after a prompt, into a newline, thus forcing the line to end, and thus allowing it to be spoken.

  • Making a plugin that checks incoming packets, and if they happen to match what looks like a prompt, add a newline.

    There is a forum posting describing this:

    http://www.gammon.com.au/forum/bbshowpost.php?id=5020

  • Make a timer that retrospectively checks the last line in the output window every half-second or so, and if it happens to be a prompt, react accordingly.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fastfinge   (2 posts)  Bio
Date Reply #2 on Sun 08 Apr 2007 11:53 AM (UTC)
Message
Thanks for that. I wrote the example up in 3 minutes by request of a friend who wanted a mud to be read out; he had used MonkeyTerm previously, but wanted the keypad support and some of the other features in mushclient that I'm not enough of a mudder to even know what to do with. I figured I'd post in case someone else in the community wanted to carry on the work and create a full featured speaking plugin. I hadn't noticed those other posts; I just saw some jaws questions in general and somewhere else.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 10 Apr 2007 10:17 PM (UTC)
Message
I should point out that the posts I mention use the SAPI (Speech API) interface, and do not need any DLLs to be installed at all, if you are using Windows XP.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Tspivey   Canada  (54 posts)  Bio
Date Reply #4 on Fri 13 Apr 2007 03:50 PM (UTC)
Message
I have a Jaws plugin and a
sapi plugin available at my website, http://www.allinaccess.com.
There appears to be an audio.xml there too, but all I remember about
it is that it uses comAudio.
Hopefully this will help someone convert to MushClient.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 13 Apr 2007 10:01 PM (UTC)
Message
I have taken the liberty of posting a copy below (I hope that is OK), in case your site goes down, and it illustrates the general idea quite nicely:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, November 05, 2005, 8:53 PM -->
<!-- MuClient version 3.68 -->

<!-- Plugin "jfw" generated by Plugin Wizard -->

<muclient>
<plugin
   name="jfw"
   author="Tyler Spivey"
   id="f4a3e103c1d8715efa157b23"
   language="VBscript"
   purpose="speaks incoming text using jfw."
   date_written="2005-11-05 20:53:14"
   requires="3.68"
   version="1.0"
   >

</plugin>

<!--  Triggers  -->
<aliases>
  <alias
   script="togglespeaking"
   match="jfw"
   enabled="y"
   group="speech"
   omit_from_command_history="y"
   omit_from_log="y"
   omit_from_output="y"
   sequence="100"
  >
  </alias>
</aliases>

<triggers>
</triggers>

<!--  Script  -->


<script>
<![CDATA[

dim jfwobject
dim speak 'do we want to speak?

sub toggleSpeaking (name, line, wc)
  if speak = 1 then
    speak = 0
    jfwobject.sayString "jfw auto speak off.", 0
  else
    speak = 1
    jfwobject.sayString "jfw auto speak on.",0
  end if
end sub

sub OnPluginInstall
  set jfwobject = CreateObject("jfwapi")
  jfwobject.sayString "jfw speech is ready to rock!",0
  speak = 1
end sub

sub OnPluginScreendraw (t, log, line)
  if (t = 0 or t = 1)  and speak = 1 then
    jfwobject.sayString line, 0
  end if
end sub
  
sub OnPluginBroadcast (msg, id, name, text)
  if msg = 222 then
    jfwobject.sayString text,0
  end if
end sub
]]>
</script>


</muclient>




His instructions for using this are:


  1. Grab the plugin (between the lines above), and put it in mushclient's plugin directory.

  2. Unzip the jaws api file, and put the jfwapictrl.dll file in a place where it'll be safe from deletion, for example in the windows directory.

    File is at: http://allinaccess.com/mc/jfwapi.zip

  3. Open a command prompt to that directory and run: regsvr32 /s jfwapictrl.dll

  4. Start mushclient and add the jfw plugin to a world. it should speak. use "jfw" in the comand window to turn it on and off.


That's all there is to it!




In place of jaws you should be able to use SAPI which comes with Windows XP.

Below is a version which does just that:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, November 05, 2005, 8:53 PM -->
<!-- MuClient version 3.68 -->

<!-- Plugin "jfw" generated by Plugin Wizard -->

<muclient>
<plugin
   name="sapi_speaker"
   author="Tyler Spivey"
   id="539af5868ca499f001d47b55"
   language="VBscript"
   purpose="speaks incoming text using jfw."
   date_written="2007-04-14"
   requires="3.68"
   version="1.0"
   >

</plugin>

<!--  Triggers  -->
<aliases>
  <alias
   script="togglespeaking"
   match="jfw"
   enabled="y"
   group="speech"
   omit_from_command_history="y"
   omit_from_log="y"
   omit_from_output="y"
   sequence="100"
  >
  </alias>
</aliases>

<triggers>
</triggers>

<!--  Script  -->


<script>
<![CDATA[

dim jfwobject
dim speak 'do we want to speak?

sub toggleSpeaking (name, line, wc)
  if speak = 1 then
    speak = 0
    jfwobject.Speak "sapi auto speak off.", 1
  else
    speak = 1
    jfwobject.Speak "sapi auto speak on.",1
  end if
end sub

sub OnPluginInstall
  set jfwobject = CreateObject("SAPI.SpVoice")
  jfwobject.Speak "sapi speaker is ready to rock!",1
  speak = 1
end sub

sub OnPluginScreendraw (t, log, line)
  if (t = 0 or t = 1)  and speak = 1 then
    jfwobject.Speak line, 1
  end if
end sub
  
sub OnPluginBroadcast (msg, id, name, text)
  if msg = 222 then
    jfwobject.Speak text,1
  end if
end sub
]]>
</script>


</muclient>



If you install this plugin you don't need to do anything else, as the SAPI is pre-installed (it is on my system anyway), so you don't need to muck around downloading DLLs and registering them.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #6 on Fri 13 Apr 2007 10:12 PM (UTC)
Message
The modified one I did which uses SAPI (and thus should not need any extra files) is now available here:

http://www.gammon.com.au/mushclient/plugins/sapi.xml

Right-click and "save as" to get a copy of the plugin on your hard disk, and then install it using the MUSHclient File -> Plugins menu item.

It has also been added to the plugins page on this site.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Newton   (2 posts)  Bio
Date Reply #7 on Mon 08 Dec 2008 03:31 AM (UTC)
Message
I just installed Tylor Spivey's jfw plugin, and my XP Home (sp2) MUSHclient is talking! The only problem is that it speaks too slowly. It is fine when I'm just idling on FurryMUCK, but when conversations start, or I 'look' at someone, the reader falls waaay behind the action.

Is there a way to speed it up to about twice the installed speech-speed? Helpful also would be a way to tell it to flush it's cache (or however it works) and pick up when something new comes in, or at least have an easy way to shut it off when activity is high? I could then use the old-fashioned method of marking text (which copies it into the Clipboard, where TTSReader sees and speaks it- at the speed I chose!).

Thank you for providing the present version, even if it can't be changed.
Top

Posted by Tspivey   Canada  (54 posts)  Bio
Date Reply #8 on Mon 08 Dec 2008 10:45 AM (UTC)
Message
Hello. The plugin will only speak as fast as you have your jaws set to speak. At least in my version,
to turn it on/off, an alias "jfw" has been defined.

The sapi speaker plugin on this page also uses the same command, and that plugin will only go as fast
as you have your rate set in the speech options in the windows control panel.
Top

Posted by Newton   (2 posts)  Bio
Date Reply #9 on Sat 27 Dec 2008 12:20 AM (UTC)
Message
Thank you! As you suggested, I opened the Control Panel, selected Speech, then moved the speed indicator 1 position to the right, clicked Apply, and the speech-speed is now just right to follow what is said (and posted during the Tuesnite Stories in OwlHaven).

Thank you also for the quick answer! I should have checked back sooner, but additional time using the plug-in has proven it is stable and VERY helpful, as I find that listening to large blocks of text is easier than reading them.

I also have MUSHclient installed on an old Win95 ThinkPad and a Windows98 desktop computer. Too much is missing from '95 for speech to work there (in fact only 'ReadPlease', of all the text-to-speech programs I've tried to get to work, does), after I installed the SAPI51 package in the Win98 computer (so that TextRecorder would work), I discovered that your speech plug-in works in Win98 too!

I haven't looked for a way to speed up the recitation in Win98 yet, but I do advise anyone reading this thread to add speech- even to older computers.

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.


37,712 views.

Posting of new messages is disabled at present.

Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.