SpokenWord: A Text-to-Speech plugin for RPG Maker MV
A downloadable plugin
SpokenWord is a plugin for RPG Maker MV that allows you to easily include text-to-speech in your projects using plugin commands, script, and/or message control characters.
SpokenWord is offered free for use in your hobby and/or commercial projects (see Terms for full conditions) but if you like the plugin please consider throwing me a buck or two and help me in my own game project. Anything helps (especially during this current world crisis).
SETUP
Once downloaded, copy the plugin file (dismal_SpokenWord.js) to your project's js / plugins folder.
After that, open your project in RPG Maker MV and use the Tools / Plugin Manager window to add the plugin to your game:
In the Plugin Manager:
Right-click at the bottom of the plugin list and select Edit:
This will open the Plugin window:
Click on the Name drop-down menu and select dismal_SpokenWord:
(If dismal_SpokenWord does not appear as any of the options, please refer to the instructions at the beginning and make sure that you have properly copied the plugin file to your project's js / plugins folder.)
The Plugin window should now appear as follows:
The Help text box contains instructions for invoking speech synthesis in your project- we'll go over that later (in the Usage section).
To the right of the Plugin window, we have the default Parameters for SpokenWord:
defaultVolume adjusts the volume that the your text will be spoken at. This can be a decimal or integer value between 0 (lowest) and 1 (highest).
defaultPitch adjusts the pitch ( the degree of highness or lowness of the voice's tone) at which your text will be spoken at. This can be a decimal or integer value between 0 (lowest) and 2 (highest).
defaultRate adjusts the speed at which your text will be spoken at. This can be a decimal or integer value between 0.1 (lowest) and 10 (highest). The default value of 1 corresponds to a normal speaking rate.
Once you have made adjustments to your liking, hit the OK button in the Plugin window, and then the OK button in the Plugin Manager window, and you'll be returned to the RPG Maker MV Map Editor, where we can begin implementing SpokenWord into your project.
USAGE
Once the plugin has been successfully added to your project, the easiest way to use SpokenWord text-to-speech in your game is by using control characters in a Show Text event command.
To do this, create a new event or edit an existing event:
The Edit command should bring up that event's Editor window:
In the contents section, right-click and select New:
Now, in the Event Commands window, click on the 1 tab and choose Show Text under the Message section:
This will bring up the Show Text window, where you can specify what text should appear in the message window when your player character interacts with this event.
RPG Maker MV uses control characters as a way to "display values of variables and names of actors by entering [them] into the text":
SpokenWord adds three additional control characters, which can be used in addition to the ones listed above:
So, let's try it out- in the Text section of the window type in the following:
\SW[Hello], can you hear me?
Now click OK to return to the Event Editor, and make sure Priority is set to "Same as characters" and Trigger is set to "Action Button" before hitting OK again and returning to the Map Editor.
Now we're ready to go! Click on the Playtest button and test it out:
That is the simplest way to implement SpokenWord in your project. For more flexibility, the plugin also offers more advanced commands.
ADVANCED COMMANDS
In the most basic example, we only used the \SW[x] control character. But what about the other two?
\SWE['x'] allows you to evaluate (execute JavaScript) x as code and display the result. So if your text was:
\SW[Hello], \SWE['$gameActors.actor(1)._name'] can you hear me?
The message box should display something like:
And you should hear "Hello" and "Harold".
* Please note that the code / expression you wish to evaluate must be wrapped in 'single quotes' for it to work.
Similarly, \SWV[x] lets you display and utter the value of the xth variable. In this example $gameVariable 5 is equal to 3, so:
\SW[Hello], \SWE['$gameActors.actor(1)._name'] can you hear me? \C[1]You owe me \SWV[5] cookies!
Should display:
And you should hear "Hello", "Harold" and "3".
Beyond control characters, SpokenWord can also be invoked using plugin commands.
spokenWord word spokenWord #VariableID spokenWord e:JavaScriptCode
Similar to control characters this will utter either a specified word, variable ID or expression.
Examples include-
spokenWord dope
You should hear "dope".
spokenWord #5
If $gameVariable 5's value is 3, you should hear "3".
spokenWord e:$gameActors.actor(1)._name
You should hear "Harold".
The second plugin command is setVoice-
setVoice vValue pValue rValue
This changes the settings (see plugin parameters in the Setup section) of volume (v), pitch (p), and speech rate (r).
So-
setVoice p2 r3
Would set the pitch to 2 and speech rate to 3.
setVoice v0.5 p0.7
Would set volume to 0.5 and pitch to 0.7.
Finally, SpokenWord has two script commands-
dismal.SpokenWord.utter("word")
Again, like the \SW[x] control character and the spokenWord plugin command, this will utter the specified word.
And lastly,
dismal.SpokenWord.setVoice(volume, pitch, rate);
This script function is similar to the setVoice plugin command.
VERSION COMPATIBILITY
SpokenWord has been tested and appears to work on RPG Maker MV version 1.6.2 on both Windows and OS X operating systems.
The code uses The Web Speech API, which is (as of May 2020) considered experimental technology, and is compatible with Chrome / Chrome for Android 33, Edge ≤79, Android Webview 4.4.3, and Samsung Internet 2.0.
TERMS OF USE
This plugin is released under a modified X11 license.
Copyright ©MMXX dismal_science__. All Rights Reserved.
Permission to use and distribute for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both copyright notice and this permission notice appear in supporting documentation.
Additional Terms of Use
- "dismal_science" must be given credit in your games.
- Do NOT change the code, filename, parameters, and information of the plugin.
- Do NOT take code for your own released plugins.
The above copyright notice, additional terms of use, and this permission notice shall be included in all copies or substantial portions of the plugin.
THE PLUGIN IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE PLUGIN OR THE USE OR OTHER DEALINGS IN THE PLUGIN.
CHANGELOG
2020.05.29 Initial Release.
Status | Released |
Category | Tool |
Release date | May 30, 2020 |
Rating | Rated 5.0 out of 5 stars (4 total ratings) |
Author | dismal_science__ |
Made with | RPG Maker |
Tags | javascript, plug-in, plugin, RPG Maker, RPG Maker MV, rpgmaker-mv, text-to-speech |
Download
Click download now to get access to the following files: