[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 The Concept of Events

Default Festival interfaces expect text on their inputs, either in a plain form or in the form of some markup. The event module generalizes the concept of input to events. Event is a general input object that can represent not only text, but also a pre-defined sound or an object just mapping to another input object.

Currently the following kinds of events are supported:

text

Text. The event value is a string containing the given text.

ssml

Text represented in the SSML 1.0 markup. The event value is a string containing the given text. Please note that festival-freebsoft-utils does not provide conforming SSML implementation and implements only a limited subset of the standard. Moreover, due to the limitations of the built-in Festival XML parser, SSML markup texts must be provided in the target encoding of the document languages.

sound

Sound icon. The value is a string containing a file name of a sound file, either absolute, or relative to the sound-icon-directory variable value.

character

Single character. The value is a string containing the character.

The difference between character events and text events is that characters may be spoken in a different way than ordinary single-letter texts.

key

A key (as on keyboard). The value is a string containing key description in the format defined by the Speech Synthesis Interface Protocol, SSIP: (ssip)Top section `Top' in SSIP.

logical

Symbolic event name, usually mapped to another event. The value is an arbitrary symbol. Logical event values starting with the underscore character are considered special and shouldn't be generally used. See section events.scm, for more details.

Any event may be mapped to another event. Before festival-freebsoft-utils functions process an event, they check for its mapping and if the event is mapped to another event, it is replaced by the target event. Event mapping is defined by the following variable:

event-mappings

Maps events of any supported kind (i.e. logical, text, sound, character, key) to other events (typically to text or sound events). All logical events used must be defined here, other kinds of events are processed in some default way if there are not defined in this variable.

The variable contains an alist whose elements are of the form (event-type mappings). event-type is one of the symbols logical, text, sound, character, key. mappings is an alist with the elements of the form (value new-event-type new-event-value).

See the default variable value for an example.

For a convenience, there is a function that allows you to add or replace single event mappings in the event-mappings variable in an easier way than redefining the whole variable value:

set-event-mapping! event-type event-value new-event-type new-event-value

Ensure the event of event-type and event-value is mapped to the event of new-event-type new-event-value.

Example:

 
(set-event-mapping! 'logical 'hello 'text "Hello, world!")

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Milan Zamazal on August, 11 2009 using texi2html 1.78.