Page 1 of 1

TTS text to speech demo by Tim

Posted: Wed Jan 27, 2021 7:27 pm
by atari2600tim
I made a very simple package that has 2 parts. A trigger will speak every incoming line. A "tts" alias will let you type some things to do extra stuff.

It does not do anything more complicated than that such as let you navigate back and that sort of thing that they're planning to build into the regular program.

It does show off the TTS features that are currently available to LUA scripts though. Someone could improve on this by making something that selects something other than just the last 5 lines, maybe using keyboard shortcuts to roll back a page or something. Just using Lua script I assume you can probably do most of the things that are planned down the line. I'll leave that for someone else if you want to try that. Also it does not filter anything out, so you might have it say "underscore" hundreds of times if your game has some text art.

Here are the available commands, just type "tts", a space, and then one of these commands:
help - list the commands
stop - stop speaking, empty the speech queue
repeat - add the last 5 lines from the screen onto the speech queue
faster or slower - speed can range from 1 to -1, this one just moves 0.25 steps in either direction
louder or softer - volume can range from 0 to 1, moves by 0.25
higher or lower - pitch can go from 1 to -1, moves by 0.25
pause - stops speaking and keeps speech queued up, but if it isn't speaking then pause doesn't do anything
resume - continues after a pause
voice - rotates between available voices
status - tells your current options

On two of my computers, changing the volume and then speaking at the adjusted volume will crash the program. This happens on Raspberry Pi OS on my Pi 4 using mudlet that I compiled myself. It also happens on Debian on my Intel Chromebook using the official release AppImage file. It works fine on 2 Windows 10 machines I tried. Therefore, in order to avoid crashing, I made a thing where you have to confirm that you accept the risk before you can move the volume down from the initial 1.0.

EDIT: I'm removing all the downloads from the rest of the thread and just updating the download on this initial post. The file attached to this has all the updates mentioned in the replies.

Re: TTS text to speech demo by Tim

Posted: Sat Jan 30, 2021 5:15 pm
by atari2600tim
Here is an update with some minor changes.

Empty or whitespace lines are now skipped. Issue 4688 on Github has discussion of it, but empty lines are a problem currently with Mudlet. There is already a fix written, but it is not in the release or Public Test Build versions of Mudlet yet.

Less than and greater than signs are now converted into the words, because Windows seems to treat them like HTML, and it ends up stopping speech completely. Issue 4689 on Github has discussion of it, so sometime in the future it will probably be handled better.

I made the adjustment steps go in intervals of 0.1 instead of 0.25. So if you increased the pitch twice to reach 1.5 for example, now you'll want to do it five times.

Re: TTS text to speech demo by Tim

Posted: Sun Jan 31, 2021 7:25 am
by atari2600tim
This one adds 'tts skip' which will interrupt and go to the next line, useful if it is reading some text art.

Also if you use 'tts voice' to cycle through voices but your system is somehow set to use a voice that is not in the list of available voices, it will now select one from the list instead of failing to find what comes after the current one in the list.

Re: TTS text to speech demo by Tim

Posted: Wed Feb 03, 2021 5:06 am
by atari2600tim
I switched the `tts stop` to use `ttsSpeak()` instead of ttsQueue(). There are some situations where ttsSpeak() will jumpstart a broken queue, so now `tts stop` can do that.

The `tts skip` has code to avoid an issue where you can interrupt in-between queued messages and break the queue. It is on github at 4737.