TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support.R4

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support.R4

Post by Lord.Ashes »

Text-To-Speech Plugin Rev 2.0 for Unofficial MapTool-1.3.b89.Plugin_Support.R4 Mod is now available!

The Unofficial MapTool-1.3.b89.Plugin_Support.R4 Mod can be downloaded from this thread...http://forums.rptools.net/viewtopic.php?f=8&t=24539

The TTS Plugin plus MaryTTS (needed for the plugin to work) can be downloaded here...https://www.mediafire.com/folder/iu47lc ... 20for%20R4

This plugin reads aloud any messages that appear in the Message Panel.

Different players can be associated with different voices allowing conversations to sound more real.

The plugin is based on the MaryTTS engine. It is recommended to install the MaryTTS engine in order to use this plugin and installation is really easy. Basically you unzip the MaryTTS ZIP file to any location you like. At the end of the attached documentation there are instruction on how to get the TTS plugin working without installing MaryTTS but there are drawbacks to this (as discussed in attached document).

I did not write MaryTTS nor am I a contributing programmer to the project. The install, for MaryTTS, provided at the above link is just a duplicate of the download available at:

http://mary.dfki.de/Download

Feel free to download it from that location instead.

Currently the TTS plugin does not support much more than turning the TTS on and off (and, of course, the actually TTS functionality). The MaryTTS server needs to be started manually (but this is also very easy) and player to voice associations must be done manually (outside MT). It is anticipated that more MT functions will be added to allow these things to be done from MT but this initial version is being release to see what kind of a response this plugin gets.

MaryTTS uses a server model where requests are sent to the server and the server sends the request back as audio. It can take MaryTTS some time to process the request into audio and thus the TTS plugin words better with shorter messages. If you need to write a long chat message, it is suggested to break it up into multiple shorter messages.

The configuration of voices is beyond the scope of this thread or even the plugin documentation (available for download at the plugin download link). There are 4 sample configurations provided and the plugin documentation describes a process which isn't too difficult on how to create may other configurations.
TTS Plugin Rev 2.txt
(13.52 KiB) Downloaded 55 times
New Features:

* GM speak command (allows requesting TTS even when player has turned TTS off for chats)
* Option to turn TTS plugin off even for GM requests
* Option to display or not display text that has been TTSed
* Functions for creating voice templates
* Functions for applying voice templates to players

Edit: Added Rev 2 info
Removed Rev 1 attachment
Last edited by Lord.Ashes on Sun Dec 15, 2013 4:34 am, edited 2 times in total.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by aliasmask »

Cool. Does this work for Wiki: broadcast() messages and what about text in tooltips? Is that read as well (not that I want it to be)? Having the ability turned off in chat but send direct requests in macro form would be nice.

edit: Heh, many of the voices sound like they're from Wallace and Grommit (in youtube example).

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

aliasmask wrote:Cool. Does this work for Wiki: broadcast() messages
It will play any messages that make it to the Message Panel...so it should work for Broadcast like for any other message.
aliasmask wrote:and what about text in tooltips?
Very good question...I am not sure. To be honest I have not tried. If the tooltip is part of the message that comes in the Message Panel, which I am guessing it is, then it may also get read. It depends on if the tooltip is part of the HTML element or part of an element's innerHTML.

Basically messages which show up in the Message Panel consist of HTML code which formats the messages. For example, a message usually has a section indicating who sent it and the actual message content. This shows up in different HTML elements when the whole message HTML is looked at. Since I don't want the HTML code to be read, I do a very basic stripping where anything between < and > is removed. So if the tooltip is a property instead the element, it would be between the < and > and in that case it would be stripped out. If on the other hand the tooltip is encapsulated in an element, such as <SPAN Id=Tooltip>This is my tooltip text</SPAN> then it would not get stripped out and in that case it would be read.
aliasmask wrote:Having the ability turned off in chat but send direct requests in macro form would be nice.
You mean having it turned off for general chat but messages that are sent to that player only (i.e. whisper or broadcast) would TTS?

That would be a little harder to do automatically because currently plugins don't have any concept of how a message got into the Message Panel. Plugins literally intercept the contents of messages being added to the Message Panel and can act on that before the message is actually displayed. They can even remove the message from being added (i.e. messages that were plugin cues instead of content to be displayed) but the plugin has no idea how a message was placed into the Message Panel. Sometimes it can get clues, for example, using /self does not indicate which player the message came from so when the player prefix is missing it could be a self command but it could also be an /emit from a GM.

However, if I change the chat .tts function to take a parameter, instead of toggling the chat, it would be possible to send a message such as:

.tts 1 This will be read! .tts0 But this will not.

It still means that the plugin does not use "who sent it or how it was sent" as a determining factor but it would allow TTS only certain messages. That is probably the best I can do in this regard without modifying MapTool itself.
aliasmask wrote:edit: Heh, many of the voices sound like they're from Wallace and Grommit (in youtube example).
I found that the basic voice (the voice installed with MaryTTS 5.0 by default) sounds fairly synthetic. You can do various adjustment on it but in the end it still sounds fairly synthetic. My to examples for the basic voice use the Robot effect and the JetPilot effect.

However, I found that some of the other voices that you can download are fairly good. I have not played with too many of the voices but I tried en_GB Poppy and en_GB Spike and they are actually not too bad.

You can try voices out, with no installation on your side (besides Java), by going to the MaryTTS interactive demo website at:

http://mary.dfki.de:59125/

Make sure that the setting are set to INPUT TYPE = TEXT, OUTPUT = AUDIO. Change the Voice selection to the desired voice...I suggest selecting something with en_GB or en_US in the name so that you get an English voice. For example, the Russian voice will not play any English text. If you want to play with effects on the voice, press the Show Audio Effects button. I have noticed that some of the effects seem to have no effect. For example, Rate seems to have no effect on the Poppy voice. I am not sure why but it has no effect on the voice during the interactive demo so it is not a fault of my plugin.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

You can test voices, without having to install anything on your machine (besides Java), by going to the MaryTTS interactive demo at:

http://mary.dfki.de:59125/

Make sure that the INPUT TYPE = TEXT and the OUTPUT = AUDIO.

Make sure that the voice you choose is appropriate for the language of the text. For voices that speak English, use voices that have en_GB or en_US in the name. For example, trying to make a Russian voice speak English words will not work.

If you want to apply effects on the voice, click the Show Audio Effects button and check mark the effects you want to apply. Not all effects seem to do things on all voices.

Remember that if you find a voice that you like, you need to download it in order to be able to use it (unless you are just playing with the default en_US voice). Download a voice is really easy and it is covered in the TXT file in the original Thread post.

Once you have downloaded the voice and configure it for a player, you can test it without needing to have the targeted players connected. To do so, turn on TTS and then type:

/self PlayerName: Message

This will use the self Chat command to send a message to yourself. Since the self command does not prefix the message with a name we can trick the TTS plugin into thinking the message was sent by someone else by typing the name followed by a colon. Obviously replace PlayeName with the player's actual name and Message with your test message. For example,

/self Bob: Hello. I am Bob.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by aliasmask »

Lord.Ashes wrote:
aliasmask wrote:Having the ability turned off in chat but send direct requests in macro form would be nice.
You mean having it turned off for general chat but messages that are sent to that player only (i.e. whisper or broadcast) would TTS?
No I mean like after installing the plug-in being able to run a macro like this:

Code: Select all

[H: textToVoice(text,targets,source)]
  • text - The text to be spoken
  • targets - The clients to hear the spoken text (default "all")
  • source - Which client is speaking (default getPlayer())
That function would not generate any text to the chat panel. This should also be a protected function (only GM can set up player access for source). It could perhaps trigger the Player is Speaking chat bubble that appears when a player is typing, so that it's not completely anonymous. Source could also be the voice profile used.

I use a custom in-character chat frame and I would definitely consider integrating this in to my games. Often times players will talk while I'm doing GM stuff and to be able to hear the in character chat would be a benefit.

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

Known Issues:

Currently the plugins used by MapTool-1.3.b89.Plugin_Support.R4 are applied in the order they are found. This may or may not be alphabetical order depending on the OS.

On my Windows machine it seems to be in alphabetical order which is good since that currently makes the TTS plugin executed last.

This is important because some plugins use chat based cues to implement various plugin features. If the TTS plugin executes before the other plugin, the TTS plugin can end up reading the other plugin's cue as opposed to the result.

At one point I was thinking of modding the Plugin_Support MapTool mod so that it has a list of enabled plugins. This could serve both as a way to turn plugins on and off without having to remove them from the plugins directory and as a way to specify in which order the plugins should be executed. However, I think that most plugins are independent and thus the order, for most plugins, is not important. Any opinions?
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by aliasmask »

Having all the plug-ins installed but not enabled would save on having the clients install them. I don't know if this could end up being an issue for available memory though (probably insignificant). Then you can have a generic panel for the installed plug-ins for the user to check and uncheck and/or set settings.

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

aliasmask wrote:

Code: Select all

[H: textToVoice(text,targets,source)]
  • text - The text to be spoken
  • targets - The clients to hear the spoken text (default "all")
  • source - Which client is speaking (default getPlayer())
I see. Well I could do something similar but remember that it would have to be via the pluginExecute() macro because the Plugin Support mod does not allow adding actual direct MT macros. But I could do something like:

Code: Select all

[R: pluginExecute("TTS","speak","text,targets,source")]
This is why I like, whenever possible, to provide a pseudo chat command for my plugins because it is much simpler to write something like

Code: Select all

.tts 1
than

Code: Select all

[R: pluginExecute("TTS","speak","text,targets,source")]
The pluginExecute structure is not ideal but it is the only way that I can think of to add any number of functions to MT (via plugins) without having to modify the MT source code.

Actually what you are asking for can already be done...but I can add a function to make it easier. Recently I have been told that Broadcast can be used to send MacroLink to execute macros on client computers. Thus you could create a macro which executes the pluginExecute("TTS","tts","1") then types some test (to the TTSed) and then executes the pluginExecute("TTS","tts","0"). Then you can broadcast the macrolink to the desired players.

But I get you point. I can add a plugin function that would do a similar task directly so that the campaign does not need a MT macro for that.
aliasmask wrote: That function would not generate any text to the chat panel.
Generally I don't like to do this because it somewhat violates the prime directive of the Plugin_Support system which is that the Campaign should not be dependent on Plugins. Plugins can enrich Campaign experience but not prevent a Campaign from working. I realize that technically not showing text for a TTS plugin won't prevent the Campaign file from working (so it technically does pass the Prime Directive) but it means that if the player forgot to turn up his/her sound (because he forgot that the campaign will use TTS), someone might be sending TTS messages to that user and the user will not be aware of it.

It is a similar situation to my Sound plugin. I still indicate a sound cue in the Message Panel because, if the sound is turned down or someone does not have the plugin, I still want them to be aware of the sound request.

Having said that there is nothing preventing one from making a plugin that would do TTS and remove the Message Panel message for such messages...but I generally disagree with that approach (for the reason above). That is just my opinion but I am the one writing the plugin so I guess that means it will be my way (unless someone uses my Source Code to spin off their own version).

I guess I could be nice and make that a setting which defaults to off. So when you start MT it displays both the message and plays the TTS but the user can actively turn off the messages for any TTS played. I'll consider that.
aliasmask wrote:This should also be a protected function (only GM can set up player access for source). It could perhaps trigger the Player is Speaking chat bubble that appears when a player is typing, so that it's not completely anonymous. Source could also be the voice profile used.
These are all good ideas but beyond the possibility of Plugin_Support plugin. For example, my limited plugins have no access to creating or modifying speech bubbles. It could be done but it would need to be a separate MT mod (its own fork) which is what I am trying to avoid by providing my Plugin_Support MT mod.

However, I can look for giving plugins access to the speech bubble in R5 of the MapTool.1-3.b89.Plugin_Support (or maybe it will be MapTool.1-3.b90.Plugin_Support by then).
aliasmask wrote:I use a custom in-character chat frame and I would definitely consider integrating this in to my games. Often times players will talk while I'm doing GM stuff and to be able to hear the in character chat would be a benefit.
Can you tell me more about the custom in-character chat? Why are you using a custom in-character chat instead of the normal chat? Is the custom in-character chat a frame that you generate using MT regular functions or is this a MT source code mod?

My limited plugin system has very limited access to the MT interface. This is both a blessing and a curse. It is a blessing because it means that the core MT functionality can not be changed and thus a Campaign file compatible with my MapTool.1-3.b89.Plugin_Support mod will be compatible with other clients running my MapTool.1-3.b89.Plugin_Support mod version of MT regardless of which plugins they have installed. On the other hand it is a curse because it means that plugins are very limited in what they can achieve inside MT.

This typically means that to do very powerful stuff plugins need to be coupled with MT macros. For example, if your custom in-character chat does not use the Message Panel window then my plugins will not be aware that a message requires translation. This would mean that I would need to create a function for performing the TTS (as you suggested above) and then you would need to add some MT macro code to trip the TTS function when new stuff is entered into the in-character chat. Is that possible on your side? If so, I am happy to add a function to the plugin that will trip the TTS (instead of it being tripped by the Message Panel directly).
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

aliasmask wrote:Having all the plug-ins installed but not enabled would save on having the clients install them. I don't know if this could end up being an issue for available memory though (probably insignificant). Then you can have a generic panel for the installed plug-ins for the user to check and uncheck and/or set settings.
Currently the number of plugins should have very little effect on MEMORY because plugins do not reside in memory when they are not being used. Only while a plugin actually needs to execute, is it loaded into memory, run and the closed afterwards. Since most plugins return almost immediately then most of the time they are not using any memory. The exception, obviously, are plugins that remain active for some longer period of time (such as Sound or TTS). These use memory while they are processing but, again, free up all that memory once their action is done. Thus having more plugins will not normally increase MEMORY. Having more plugins will increase disk space but all my plugins, so far, are in the few KB disk space as opposed to MB, GB or TB o today's storage disks. So I don't think that is an issue. Technically my TTS plugin takes MB because it requires MaryTTS and can take up to hundreds of MB if you download a lot of voices but this space would be taken up regardless if the plugin is active or not (i.e. the space would be taken up as long as MaryTTS is installed).

There is a potential performance issue if you have many plugins installed because each time you type something it needs to be processed through all the plugins to see if any one of them have MessagePanelHandler function to re-process the message content. I have 12 plugins installed currently and I don't see any significant delay.

You are correct that if I had a list of active plugins and only used those it would be very trivial to write a menu system that would enable and disable plugins because all it would need to do is add or remove entries from the list. The list could then be used to set the order of plugin execution and it could even mark plugins with MessagePanelhandler functions so that when something is typed at the chat windows it would know which plugins to process it against (as opposed to trying them all to see which ones have MessagePanelhandler functions, at it is currently doing).
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by aliasmask »

Lord.Ashes wrote:
aliasmask wrote:I use a custom in-character chat frame and I would definitely consider integrating this in to my games. Often times players will talk while I'm doing GM stuff and to be able to hear the in character chat would be a benefit.
Can you tell me more about the custom in-character chat? Why are you using a custom in-character chat instead of the normal chat? Is the custom in-character chat a frame that you generate using MT regular functions or is this a MT source code mod?
It's a chat frame in MT generated by regular functions. All of our OOC happens in normal chat window while the in-character chat is specially formatted based on context and emotes. At the end of the session I can then export all the in-character chat and post it online in the campaign forums. (for example: http://www.epicwords.com/forums/12699) That chat isn't formatted because I haven't created a BBCODE exporter, so it's just the text with no formatting, but in game it's colorful and stylized.

Example tooltip for my formatting:
Spoiler
Image
It's a part of my lib:players drop-in using the IMPERSONATE macro.

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

aliasmask wrote:It's a part of my lib:players drop-in using the IMPERSONATE macro.
So the question is: can you cause a new entry in this dialog to trip MT function (such as the new pluginExecute("TTS","speak","Source:Target:Message") which allows sending TTS request to multiple people). If so, then you can use the new pluginExecute("TTS","noText","1") to tell the TTS plugin not to display chat messages which have been TTSed. If you want just you side to be TTSed then you can use the speak function with only your name. That way the other players never get the TTS request and therefore they don't even need to have the TTS plugin.

Please note that obviously, to use this solution, you and your players would all have to use the Unofficial MapTool-1.3.b89.Plugin_Support version of MT (because the official version does not have plugin support). However, as I said, your players would not need to have the TTS plugin if you are just using it to have your side of the conversation TTSed.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

Rev 2.0 of the TTS plugin is now available!

Added Features:

* Speak (GM only) MT macro function which requests TTS even when the TTS plugin is set to "off for chat messages".
This allows players to accept GM TTS requests but not TTS all chat window messages.

* TTS plugin can now be set to 3 states: on (1), off for chat (0) and completely off (-1).
When in "off for chat" mode, normal chat messages are not TTS but GM speak messages are TTSed.
When in "off" mode, no TTS requested (even GM) are processed.

* noText function determines if text is still shown in the chat window if the contents have been TTSed.
A setting of 0 means noText is off and thus text is shown even if TTSed. A setting of 1 means no text is displayed if TTSed.

* The Default voice can now be configured but a default (yes...a default for the default) is provided if the Default voice is not set.

* Voices are now stored as templates in the config directory an can be made either manually outside MT or using the new MT createVoice function.
This function is still very primitive allowing you top basically provide the MaryTTS settings for the voice. It does not break out the settings
into individual components.

* Voice templates can be assigned to players using the new MT clone function.

* Better TTS control for turning on and off TTS from the chat window.

* Included instructions, in the plugin text file, on how you can use the TTS plugin with all voices without needing to install MaryTTS. See original post for document.

I have, on purpose, provided access to the createVoice and clone function to both GM and players because in campaigns which the GM does not make use of TTS a player may still want to use TTS on his/her client side. In such a case the player would need to create and/or assign voices to players (not the GM).
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

Tip: Assigning Voices

You can assign voices to anything...it does not need to be existing players. This means you can assign voices to tokens (when tokens are impersonated) or even completely fictitious entities for use with source faking.

Basically if a message comes into the Message Panel and it starts with (after HTML is cut out) text followed by a colon (where the text does not contain a space), the TTS plugin assumes that it is a voice indication.

This is actually the reason why you can use the syntax:

/self Name: Message

to test voices because the self command does not prefix messages and thus the above syntax results in

Name: Message

being placed into the Message Panel. The TTS plugin recognizes this as a message from Name and thus invokes the corresponding voice.


Tip: TTSing only non-Default message

To TTS only messages that come from sources from which you have define a voice, you can set the Default voice to nothing.
This should cause any default voice requests to fail but messages from sources that you have associated with different voices
will still use their own voice to TTS.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by aliasmask »

Thanks, this looks very doable. I'll have to play around with this in the near future. I have my own project that I'm working on for my group (redoing elements of PF framework from scratch), so it's something I won't test right away.

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: TTS Plugin for Unofficial MapTool-1.3.b89.Plugin_Support

Post by Lord.Ashes »

aliasmask wrote:Thanks, this looks very doable. I'll have to play around with this in the near future. I have my own project that I'm working on for my group (redoing elements of PF framework from scratch), so it's something I won't test right away.
I assume you are using an unmodded MT? Is it b89 based or b90 based?
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

Post Reply

Return to “User Creations”