Online Book Reader

Home Category

Beautiful Code [334]

By Root 5000 0
queues the auditory icon at the right point in the output stream.

31.2.8. The Calendar: Enhancing Spoken Output with Context-Sensitive Semantics

To summarize the story so far, Emacspeak has the ability to:

Produce auditory output from within the context of an application

Audio-format output to increase the bandwidth of spoken communication

Augment spoken output with auditory icons

This section explains some of the enhancements that the design makes possible.

I started implementing Emacspeak in October 1994 as a quick means of developing a speech solution for Linux. It was when I speech-enabled the Emacs Calendar in the first week of November 1994 that I realized that in fact I had created something far better than any other speech-access solution I had used before.

A calendar is a good example of using a specific type of visual layout that is optimized both for the visual medium as well as for the information that is being conveyed. We intuitively think in terms of weeks and months when reasoning about dates; using a tabular layout that organizes dates in a grid with each week appearing on a row by itself matches this perfectly. With this form of layout, the human eye can rapidly move by days, weeks, or months through the calendar and easily answer such questions as "What day is it tomorrow?" and "Am I free on the third Wednesday of next month?"

Notice, however, that simply speaking this two-dimensional layout does not transfer the efficiencies achieved in the visual context to auditory interaction. This is a good example of where the right auditory feedback has to be generated directly from the underlying information being conveyed, rather than from its visual representation. When producing auditory output from visually formatted information, one has to rediscover the underlying semantics of the information before speaking it.

In contrast, when producing spoken feedback via advice definitions that extend the under-lying application, one has full access to the application's runtime context. Thus, rather than guessing based on visual layout, one can essentially instruct the underlying application to speak the right thing!

The emacspeak-calendar module speech-enables the Emacs Calendar by defining utility functions that speak calendar information and advising all calendar navigation commands to call these functions. Thus, Emacs Calendar produces specialized behavior by binding the arrow keys to calendar navigation commands rather than the default cursor navigation found in regular editing modes. Emacspeak specializes this behavior by advising the calendar-specific commands to speak the relevant information in the context of the calendar.

The net effect is that from an end user's perspective, things just work. In regular editing modes, pressing up/down arrows speaks the current line; pressing up/down arrows in the calendar navigates by weeks and speaks the current date.

The emacspeak-calendar-speak-date function, defined in the emacspeak-calendar module, is shown here. Notice that it uses all of the facilities described so far to access and audio-format the relevant contextual information from the calendar:

Code View: Scroll / Show All

(defsubst emacspeak-calendar-entry-marked-p( )

(member 'diary (mapcar #'overlay-face (overlays-at (point)))))

(defun emacspeak-calendar-speak-date( )

"Speak the date under point when called in Calendar Mode. "

(let ((date (calendar-date-string (calendar-cursor-to-date t))))

(cond

((emacspeak-calendar-entry-marked-p) (tts-speak-using-voice mark-personality

date))

(t (tts-speak date)))))

Emacs marks dates that have a diary entry with a special overlay. In the previous definition, the helper function emacspeak-calendar-entry-marked-p checks this overlay to implement a predicate that can be used to test if a date has a diary entry. The emacspeak-calendar-speak-date function uses this predicate to decide whether the date needs to be rendered in a different voice; dates that have calendar entries are spoken using the mark-personality voice. Notice

Return Main Page Previous Page Next Page

®Online Book Reader