Text-to-speech

Asked by Gordon Ball on 2010-01-12

I was looking at what was necessary to synthesize notifications received on a system (using festival, although I guess any other engine works as well).

My first thought was that I could write a seperate DBUS client for /org/freedesktop/Notifications/Notify, but if I understand this correctly this is an exported function rather than a signal listener, so I can't add a second program that will receive these messages without unloading the first one.

I crudely patched notify-osd to achieve this effect

stack.c, line 605ish (in stack_notify_handler() )
<CODE>
 gchar *argv[15];
 memset (argv, 0 , 15*sizeof(gchar*));
 argv[0]="festival";
 argv[1]="--tts";
 gint stdin_fd = -1;
 GPid child_pid = 0;
 if (g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, &stdin_fd, NULL, NULL, NULL)) {
  if (stdin_fd != -1) {
   write(stdin_fd, filter_text(summary), strlen(filter_text(summary)));
   write(stdin_fd, "\n\n", 2);
   write(stdin_fd, filter_text(body), strlen(filter_text(body)));
   write(stdin_fd, "\0", 1);
   close(stdin_fd);
  }
 }
</CODE>

plus add
<CODE>
#include "util.h"
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
</CODE>
to the includes of this file.

Which seems to work, triggering TTS notifications asynchronously when new messages arrive (although without sanity features like avoiding multiple TTS instances running at once, or perhaps more importantly any way of turning it off).

My question is how should this be done properly? If my understanding that I cannot have multiple programs listening to DBUS for notifications in the first place is right, could there be some hook in notify-osd to allow custom actions/script to occur when a notification is received? Is there another level rather than notify-osd this should be happening at?

Gordon

Question information

Language:
English Edit question
Status:
Answered
For:
Notify OSD Edit question
Assignee:
No assignee Edit question
Last query:
2010-01-12
Last reply:
2010-01-23
Dimitri John Ledkov (xnox) said : #1

You beat me to this =)))) I was thinking about implementing this so that Ubuntu can speak to me the new title of the song from banshee notification ;-)

Dimitri John Ledkov (xnox) said : #2

I did a little bit of research and I'm gonna work on text-to-speech for notification....

Using dbus-spy I can get the notifications sent over the dbus!

http://mvidner.blogspot.com/2008/06/d-bus-spy.html

dbus-spy-0.1.py -b SessionBus -f /org/freedesktop/Notifications

Christopher (captain-c) said : #3

While this comment is wholly unhelpful, I just had to mention that this is a fantastic idea. I look forward to testing for you guys.

Wayne Rodrigues (waynerod10) said : #4

Can someone make a bug report or feature request for this? It would be an awesome idea!

Can you help with this problem?

Provide an answer of your own, or ask Gordon Ball for more information if necessary.

To post a message you must log in.