MythSpeech

From MythTV Official Wiki
Revision as of 16:55, 31 December 2012 by Monkeypet (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MythTV for blind/visually impaired

Introduction

Mythspeech is an answer to A Plea to the Programmers made on the mythtv-users list in August, 2012. The first working iteration takes advantage of MythTV’s support for LCD displays. As a result, it is possible to provide a working solution that modifies one relatively small executable (mythlcdserver) that is included with MythTV. But building on MythTV’s support for LCD displays has its limitations, discussed later.

Getting Started

Requirements

  • Ubuntu 12.04 LTS or a distribution based on it, such as Mythbuntu 12.04. Both 32 bit and 64 bit flavours are supported by Mythspeech.
  • MythTV 0.25. Mythspeech has been tested with these versions from the MythTV Updates repository:
    • 2:0.25.2+fixes.20120922.0817eb2-0ubuntu0mythbuntu4
    • 2:0.25.3+fixes.20121202.57baf5b-0ubuntu0mythbuntu3
    • 2:0.25.3+fixes.20121206.0b60406-0ubuntu0mythbuntu3

The above requirements assume you want to use the mythlcdserver executable provided in the mythspeech package. If you wish to use a different distribution or MythTV version, you will probably need to compile from source. For that reason, a patch file is included with the mythspeech package. The source is also available on github: https://github.com/monkeypet/mythtv

How to compile from source is not covered here.

Download Mythspeech

If you are using the 64 bit flavour of Ubuntu, download: http://www.hbuus.com/~buus/mythspeech-0.4.tgz

If you are using the 32 bit flavour of Ubuntu, download: http://www.hbuus.com/~buus/mythspeech-0.4-i386.tgz

Extract Mythspeech

Extract the file's contents with the command:

$ tar xzf mythspeech-version.tgz

where version is either 0.4 (64 bit version) or 0.4-i386 (32 bit version).

This will create the directory, mythspeech-version, which will contain the following files:

installspeech
A shell script that will install the non-source files in the desired locations.
mythlcdserver
The executable that does the speaking in response to messages from mythfrontend.
mythspeech
A shell script that starts up mythlcdserver and makes sure logging output is captured in the directory, $HOME/mythspeech. It also works around a potential race condition to make sure mythlcdserver doesn't start until mysql, the database server, is up and running.
mythspeech-version.patch
This is a patch file that can be applied to the mythtv source. It only touches files in mythtv/programs/mythlcdserver.
xprofile
Shell code that should be added to $HOME/.xprofile to make sure mythlcdserver is started when the computer is rebooted.

Install Dependencies

If you are using the Mythbuntu 12.04 distribution, you need to install speech-dispatcher (it's pre-installed on Ubuntu 12.04):

$ sudo apt-get install speech-dispatcher

Test it with the command:

$ spd-say "Hello world"

Install Mythspeech

$ cd mythspeech-version
$ ./installspeech

To start mythlcdserver, execute the command:

$ $HOME/bin/mythspeech

This will be done automatically on the next reboot. However, if you ever have a problem, you can always restart mythlcdserver by executing the above command.

Configure Mythfrontend

Once the above steps have been completed, you need to configure mythfrontend to talk to mythlcdserver.

  • From the main menu, navigate to Setup -> Appearance.
  • On the last page labeled LCD device display, check Enable LCD device. This will make available a number of other settings specific to LCD display devices. You don't need to change them, they don't affect the speaking done by mythlcdserver.
  • Cursor down to Finish. This will save the setting and take you back to the main menu. If mythspeech successfully started mythlcdserver, and if speech-dispatcher is working properly, you should now hear MYTH MAIN Menu Media Library. If not, it's time to check the log in $HOME/mythspeech.

Limitations

There's a lot of information that isn't provided by mythfrontend to mythlcdserver, like program guide data and information about programs on live TV that mythfrontend shows if you just cursor up/down, but don't change the channel by pressing OK. Also, when I added the live TV support, I found it affected what happens when you watch a recording. It now tells you what you've just started to play, even though it just told you before you started playing it.

Development Notes

I had first tried to do something with the work done by NCAM (National Center for Accessible Media), which can be found here:
http://ncam.wgbh.org/invent_build/analog/speech-solutions-for-next-generation-media-centers/technical-notes-on-talking-myt
But things have changed so much since that was done (on mythtv 0.21 in 2008) that I abandoned it. FWIW, I had actually managed to get the original implementation working on mythbuntu 10.04.

Next, I started looking at using Qt's approach, which would require implementing Qt accessibility classes. If this were done, mythfrontend would then talk to the Orca screen reader. I have confirmed that at least one other QT application, vlc, can generate speech through Orca and speech-dispatcher. More information on Qt accessibility can be found here:
http://qt-project.org/doc/qt-4.8/accessible.html
http://blog.qt.digia.com/2011/08/23/accessibility-on-linux/
http://lists.qt-project.org/pipermail/interest/2012-March/001197.html

VLC's pop up menus don't generate speech, but the regular menus do, if you:

  • turn on the Orca screen reader.
  • export QT_ACCESSIBILITY=1
  • start vlc from the command line.

Just as I was about to launch into the "Qt approach", the email thread that kicked this off two months earlier (and which had been dormant) became active again. One person tossed out the idea of doing something with how mythtv supports LCD displays (see Mythlcdserver). I took a look at it, and was able to get the LCD feature working pretty easily using LCDproc’s support for curses simulation. So I took a look at the code for mythlcdserver and realized it wouldn't be that hard to modify that program to do the speaking.

I modified mythlcdserver to talk to speech-dispatcher via its libspeechd library. You can read about it here: http://devel.freebsoft.org/speechd It is what Ubuntu 12.04's screen reader, Orca, uses. Monkey Pet has also compiled and tested it with MythTV 0.26.

I chose to use the speech-dispatcher approach, as opposed to what was done for NCAM, because I believe it's a cleaner approach and consistent with the direction Ubuntu is going in with regard to accessibility.

Future Direction

I believe that, long term, accessibility for the blind/visually impaired should be based on Qt's support for accessibility. However, that will be more work and I wanted to get something working in 0.25, since that is the version the original plea was for. IMHO, what I'm doing is a short term hack, although I am trying to make it as functional as possible without having to touch anything other than mythlcdserver code. I also plan to support it through MythTV 0.26.

I welcome any feedback, as well as thoughts on the mythlcdserver approach vs Qt accessibility vs NCAM vs something I haven't thought of.