You can make Mudlet speak outloud by doing the following:
ttsSpeak("Wow my Mudlet can talk!")
Note: Available in Mudlet 3.16.
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 ttsQueueSpeech():
ttsQueueSpeech("We begin with some text") ttsQueueSpeech("And we continue it without interruption")
You can see what's currently in the text queue with ttsGetSpeechQueue(), pause/resume the speech with ttsPauseSpeech()/ttsResumeSpeech(), 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().
Once you've set upon using a particular voice, you can tweak the speech speed with ttsSetSpeechRate(), adjust the volume with ttsSetSpeechVolume(), and adjust the pitch with ttsSetSpeechPitch().
If Text-to-Speech is not saying anything at all, check that ttsGetVoices() has any voices - they might not be available on your platform.