Manual:Text-to-Speech

From Mudlet
Revision as of 07:58, 30 January 2019 by Vadi (talk | contribs) (Update functions for removal of 'speech')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Basics

You can make Mudlet speak outloud by doing the following:

ttsSpeak("Wow my Mudlet can talk!")

Note Note: Available in Mudlet 3.17.

The same works from an alias or a trigger - try adding an alias with a pattern ^say (.+)$ and the code of:

ttsSpeak(matches[2])

Doing say hello world! will say your text for you. That's all you need to get started!

Advanced

If you've added a few triggers and played around with it for a bit, you might notice one problem - ttsSpeak() is great and simple, but it also won't wait for current spoken text to finish. If you start saying something else in the middle of it, the current speech will be interrupted and the new text will start. Sometimes this is good, sometimes it's not. When you'd like to add text to a queue, you can use ttsQueue():

ttsQueue("We begin with some text")
ttsQueue("And we continue it without interruption")

You can see what's currently in the text queue with ttsGetQueue(), pause/resume the speech with ttsPause()/ttsResume(), clear the queue ttsClearQueue(), and get the text that is currently being spoken with ttsGetCurrentLine().

See the current state of the TTS engine (ready, paused, speech started, error, unknown) with ttsGetState().

Tweaking Text-to-Speech

Different voices will be available depending on the computer you use (Windows/macOS/Linux). You can get the list of available voices with ttsGetVoices(), get the current one in use with ttsGetCurrentVoice(), and choose a particular voice with ttsSetVoiceByName()/ttsSetVoiceByIndex().

Once you've set upon using a particular voice, you can tweak the speech speed with ttsSetRate(), adjust the volume with ttsSetVolume(), and adjust the pitch with ttsSetPitch().

Troubleshooting

If Text-to-Speech is not saying anything at all, check that ttsGetVoices() has any voices - they might not be available on your platform.