speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Speechd] speechd-el - what am I doing wrong


From: Tim Cross
Subject: Re: [Speechd] speechd-el - what am I doing wrong
Date: Thu, 22 Aug 2019 11:03:52 +1000
User-agent: mu4e 1.3.4; emacs 27.0.50

Milan Zamazal <address@hidden> writes:

>>>>>> "TC" == Tim Cross <address@hidden> writes:
>
>     TC> I want to add some feedback to mu4e. I have put the following in my 
> init
>     TC> file
>
>     TC>   (add-hook 'speechd-speak-hook
>     TC>     (lambda ()
>     TC>       (speechd-speak-command-feedback mu4e-headers-next after 
> (speechd-speak-read-line))
>     TC>       (speechd-speak-command-feedback mu4e-headers-prev after 
> (speechd-speak-read-line)))                                  
>     TC>      (speechd-set-rate 70)))
>
>     TC>   (speechd-speak)
>
>     TC> The two mu4e functions are the ones called when you hit 'n' or 'p' to
>     TC> move to the next/previous message in the message summary view. Without
>     TC> them, hitting n or p does not generate any speech. My hope was that by
>     TC> defining the above, hitting n or move to the next summary line and 
> speak
>     TC> the line. Unfortunately, I get no output.
>
> Hi, do you get absolutely no output?  I'd try to replace
>
>   (speechd-speak-command-feedback mu4e-headers-next after 
> (speechd-speak-read-line))
>
> with
>
>   (speechd-speak-command-feedback mu4e-headers-next after
>     (let ((speechd-default-text-priority 'important)
>           (speechd-speak-whole-line t)) 
>       (speechd-speak-read-line)))
>
> Does it help?
>
Hi Milan,

I worked it out (I think). It was to do with how mu4e generates/displays
the line - it isn't really a line, but a list of fields. Anyway, I went
a step further to make the output a little more 'friendly'. In case
anyone finds it useful, I've copied it below.

The only remaining and annoying issue I have is that for some reason, my
setting for speech rate keeps reverting to a much slower rate. Can't
seem to track down where this is happening. Have set my default speech
dispatcher rate (globally and locally), speech dispatcher client rate
and also in speechd-speak-hook, but rate seems to revert to a much
slower rate at what seems fairly random points. Seems to be worse with
IBM ViaVoice than espeak-ng, which makes me think it is the TTS dying
and being re-started, but don't know why it isn't being restarted with
the default rates I have set. 

I still have a couple of other issues I'm trying to fix. In particular,
there is a bug relating to speechd-el and either flycheck or eldoc (not
narrowed it down yet) which prevents backspace from working (args out of
range error). I haven't really tried to track it down yet, but plan to.

Apart from those two issues, all seems to work OK. Anyway, here is my
speechd-el config for mu4e which makes the header view lines speak.

(defun speechd-mu4e-msg-status (flags)
  (mapconcat (lambda (e)
               (case e
                 ('draft "draft message")
                 ('flagged "which is starred")
                 ('new "new message")
                 ('seen "seen message")
                 ('passed ", has been forwarded")
                 ('replied "you have replied to")
                 ('trashed "and is marked deleted")
                 ('attach "with attachments")
                 ('encrypted ", is encrypted")
                 ('signed ", is signed")
                 ('unread "unread"))) flags " "))

(defun speechd-mu4e-speak-msg-header ()
  (let* ((mail-list (mu4e-message-field-at-point :mailing-list))
         (from-1 (first (mu4e-message-field-at-point :from)))
         (from (concat (if (listp from-1)
                            (first from-1)
                         from-1)
                       (if mail-list
                           (format " in list %s" mail-list)
                         "")))
         (subject (mu4e-message-field-at-point :subject))
         (date (format-time-string mu4e-headers-date-format
                                   (mu4e-message-field-at-point :date)))
         (flags (speechd-mu4e-msg-status
                 (mu4e-message-field-at-point :flags))))
    (speechd-out-text (format "%s from %s subject %s on %s"
                              flags from subject date)
                      :priority 'text)))

(speechd-speak-command-feedback mu4e-headers-next after
                                (speechd-mu4e-speak-msg-header))

(speechd-speak-command-feedback mu4e-headers-prev after
                                (speechd-mu4e-speak-msg-header))



-- 
Tim Cross



reply via email to

[Prev in Thread] Current Thread [Next in Thread]