You can make Mudlet speak outloud by doing the following:
ttsSpeak("Wow my Mudlet can talk!")
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:
say hello world! will say your text for you. That's all you need to get started!
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().
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().
If Text-to-Speech is not saying anything at all, check that ttsGetVoices() has any voices - they might not be available on your platform.