So, I've been playing with this a bit on my raspberry pi and it's working fairly well, but I'm used to much nicer voices than espeak/flite/festival/pico2wave/etc...
... so I created a new backend.
My desktop machine is Windows, and it's on 24/7, and as a UNIX head, I naturally have cygwin installed on it, so I thought maybe I could use this to bring better voices to xbmc on Linux.
So I gutted an old daemon I wrote years ago in perl and used it as a base and made this:
http://codepad.org/Gk7pHS2l
It acts as a standalone HTTP server that listens on port 8256 by default. You can POST to
http://host:8256/speak.wav and it'll throw a wav file back at you with the requested speech. It takes args called "voice", "rate" and "text".
If you go to
http://host:8256/ it'll give you a basic form to use to generate a wav of the speech you want from any of the available SAPI5 voices on the host server. You can also request /voices for a list of available voices.
After I had that working to my satisfaction, I went and copied the espeak.py backend from services.xbmc.tts and used it as my base to create a backend to interface with my HTTP server.
You can see the code for that one (lib/backends/ttsd.py) here:
http://codepad.org/Jia67mny
Then I added my backend into lib/backends/__init__.py, rebooted and enabled it, and am very pleased with xbmc on my pi, with text-to-speech using Loquendo Dave as my voice.
Currently, my backend doesn't let me choose the voice, speed or change the httphost in the addon configuration area. I tried adding a couple of entries to the settings.xml file under resources, but that didn't seem to do anything at all. I'm probably missing something, though, as I'm learning as I go and mostly using the existing code as a guide rather than any deep intimate knowledge of how it all snaps together.
My backend writes the wav to disk before playing it. This is simply because that's how all the other backends that rely on xbmc to output the sound are working. If there's a way to feed the was straight from the remote server into xbmc's wav playback facilities without writing it to disk, that'd probably be a good idea.
I realise this setup is a little esoteric, but I think there's a place for this backend in xbmc tts. A lot of people are running xbmc on a pi or other low powered device which relies on pulling media off another machine on the local LAN that's on all the time and is considerably more powerful, so it seems worthwhile to be able to make use of that. I don't have a Mac, but it's probably trivial to modify my perl code to make it run on a Mac and use the Mac speech API, too.
For anyone who wants to run the perl HTTP server themselves on windows, you'll need cygwin, perl, the perl win32 modules (these are in the cygwin package repo), and the perl HTTP-Daemon package (I had to install this manually from source). It's highly likely that you can run this with a Windows version of Perl, not under cygwin, but I've not tried.
ruuk: Any chance you can import my ttsd backend into your source tree?
Cheers!