A.3 AFL

This section documents the LISP-CLOS functions and macros that make up AFL. Note that symbols like new-block that provide the external interface to AFL are exported symbols of package AFL; hence, all names are written without the package prefix, afl:.

The following are common to all the components of AFL.

new-block &body body [MACRO]

AFL block statement. Introduce a local instance of variable *current-speech-state*; set it to the instance of *current-speech-state* that was referenceable just before execution of the block; and execute body within this local scope. Within the block, all (free) occurrences of *current-speech-state* refer to the new local variable. Upon termination of the block, destroy local variable *current-speech-state* and reset the state of the underlying hardware to its pre-existing state. The AFL block also functions as a cobegin statement. A block terminates only after all events commenced within it have finished executing.

terminate-block   [FUNCTION]

The currently-executing AFL block is terminated immediately. A browser can execute this statement when the audio rendering of an object is to be prematurely terminated because of a user interrupt.

local-set-state new-state [GENERIC FUNCTION]

Set AFL local state to new-state. The type of new-state determines which component is set. Each component subspace provides a method on this function to perform the necessary actions when its state is set.

global-set-state new-state [GENERIC FUNCTION]

Set AFL global state to new-state. The type of new-state determines which component is set. Each component subspace provides a method on this function to perform the necessary actions when its state is set.

The following subsections document the different component subspaces of AFL. Each component subspace provides methods on the generic functions corresponding to the AFL assignment statements. For the sake of brevity, we will not document each of the individual methods.

A.3.1 The Total Audio Space

The total audio space is the cross product of the component subspaces. Its state variable is an n-tuple made up of the state variables of the component subspaces.

initialize-total-space   [FUNCTION]

Create and initialize AFL variables that encapsulate the local and global state of the total audio space.

*current-total-audio-state* nil [VARIABLE]

AFL total state in the current local scope.

*global-total-audio-state* nil [VARIABLE]

AFL total state in the global scope.

A.3.2 The Speech Component

Initializing the speech space.

initialize-speech-space &optional (voice *default-voice*) [FUNCTION]

Initialize speech space by setting up local and global speech state. Optional argument voice is the name of a point in speech space to which these should be initialized —the default is *default-voice*.

*default-voice* ’paul [VARIABLE]

Name of default voice used to initialize speech space.

*global-speech-state* nil [VARIABLE]

Contains global speech state of AFL.

*current-speech-state* nil [VARIABLE]

Contains local speech state of AFL.

re-initialize-speech-space &optional (voice *default-voice*) [FUNCTION]

reinitialize speech space with voice, the name of a point in speech space.

Speech space operators.

The speech space operators do not cause any side-effects.

move-by (point point-in-speech-space) dimension offset &key (slot ’value) [METHOD]

Return point reached by moving from point along dimension by offset. Default is to change the dimension value. If called with :slot ’step-size, modify the step size instead.

step-by (point point-in-speech-space) dimension n-steps &key (slot ’value) [METHOD]

Return point reached by moving from point by n-steps along dimension. Default is to change the dimension value. If called with :slot ’step-size, modify the step size instead.

move-to (point point-in-speech-space) dimension-value &key (slot ’value) [METHOD]

Return point reached by moving from point along dimension to value. If called with :slot ’step-size, modify the step size instead.

scale-by (point point-in-speech-space) dimension scale&key (slot ’value) [METHOD]

Return point reached by scaling value along dimension by scale. If called with :slot ’step-size, modify the step size instead.

multi-move-by (point point-in-speech-space) &rest settings [METHOD]

Move from point along several dimensions; settings is a list of dimension-value pairs.

multi-move-to (point point-in-speech-space) &rest settings [METHOD]

Move from point along multiple dimensions; settings is a list of dimension-value pairs.

multi-scale-by (point point-in-speech-space) &rest settings [METHOD]

Return the result of scaling point along multiple dimensions, where settings is a list of dimension-value pairs.

multi-step-by (point point-in-speech-space) &rest settings [METHOD]

Return result of stepping along multiple dimensions from point, where settings is a list of dimension value pairs.

generalized-afl-operator (point point-in-speech-space) &rest settings [METHOD]

Operate on point and return result. Settings is a list of triples —operation, dimension, value.

set-final-scale-factor dimension factor [FUNCTION]

Set final scale factor for dimension to factor. Final scaling is applied before producing output.

Speech events.

pause milliseconds [FUNCTION]

Insert milliseconds milli-seconds of pause.

send-text text [FUNCTION]

Send text to the speech device.

speak-number number-string [FUNCTION]

Send number-string to the speech device.

force-speech   [FUNCTION]

Force speech immediately. Used when speech is to be produced before a sentence end marker has been sent.

with-surrounding-pause pause-amount &body body [MACRO]

Execute body with surrounding pause specified by pause-amount.

Intonational structure.

comma-intonation   [FUNCTION]

Generate a comma intonation. Applies to the clause last sent.

period-intonation   [FUNCTION]

Generate a period intonation. Applies to the clause last sent.

interrogative   [FUNCTION]

Send an interrogative intonation. Applies to the clause last sent.

exclamation   [FUNCTION]

Send exclamation intonation. Applies to the clause last sent.

exclamatory-stress   [FUNCTION]

Send exclamatory stress. Applies to the next phrase to be sent.

primary-stress   [FUNCTION]

Send primary stress. Applies to the next phrase to be sent.

secondary-stress   [FUNCTION]

Send secondary stress. Applies to the next phrase to be sent.

subclause-boundary   [FUNCTION]

Insert a subclause boundary. Applies to the next phrase to be sent.

high-intonation   [FUNCTION]

Generate H*, rising intonation. Applies to the next phrase to be sent.

low-intonation   [FUNCTION]

Generate L*, falling intonation. Applies to the next phrase to be sent.

high-low-intonation   [FUNCTION]

Generate Hl, rise and fall intonation. Applies to the next phrase to be sent.

paragraph-begin   [FUNCTION]

Begin a paragraph, rising pitch. Applies to the next phrase to be sent.

Points in speech space.

save-point-in-speech-space name point [FUNCTION]

Associate name with point, a point in speech space.

define-standard-voice name &rest settings [FUNCTION]

Define a standard voice named name specified by settings, a list of dimension-value pairs.

get-point-in-speech-space name [FUNCTION]

return predefined point named name.

Dimensions in speech space.

list-of-speech-dimensions   [FUNCTION]

Return list of speech-space dimension names.

minimum-value dimension [FUNCTION]

Return minimum value for dimension.

maximum-value dimension [FUNCTION]

Return maximum value for dimension.

dimension-range dimension-name [FUNCTION]

Return difference between maximum and minimum values for dimension dimension.

length-of-subinterval dim n [FUNCTION]

Return length of a subinterval when dimension dim is subdivided into n 1 subintervals.

A.3.3 The Non-Speech Audio Component

Initializing the non-speech component.

initialize-audio-space   [FUNCTION]

Create and initialize the local and global states of the non-speech component to default values.

*global-audio-state* nil [VARIABLE]

Contains global state of the non-speech audio component.

*current-audio-state* nil [VARIABLE]

Contains local state of the non-speech audio component.

The non-speech audio space provides methods on the generic functions for the assignment statements.

Non-speech space operators.

select-sound (point point-in-audio-space) (sound string) [METHOD]

Return point with this sound selected. Sound is the name of a sound-file.

select-sound (sound string) (point point-in-audio-space) [METHOD]

Return point with this sound selected. Sound is the name of a sound file.

switch-on (point point-in-audio-space) &key (synchronize nil) [METHOD]

Return a new point with its switch turned on. Executes asynchronously by default. Call with :synchronize t to synchronize with other ongoing events.

switch-off (point point-in-audio-space) &key (synchronize nil) [METHOD]

Return a new point with its switch turned off. Executes asynchronously by default. Call with :synchronize t to synchronize with other ongoing events.

toggle-switch (point point-in-audio-space) &key (synchronize nil) [METHOD]

Return point, with its audio-player switched toggled.

Executes asynchronously by default. Call with :synchronize t to synchronize with other ongoing events.

play-once (point point-in-audio-space) [METHOD]

Play the sound selected by point once.

move-to (point point-in-audio-space) dimension value &key &allow-other-keys [METHOD]

Move from point to value along dimension.

Non-speech events.

synchronize-and-play soundfile &key (background-flag nil) [FUNCTION]

wait until all ongoing simple events have stopped executing and then play soundfile, an audio file. If background-flag is t, then the sound is played in the background (asynchronously).

Pronunciation

define-pronunciation string pronounced-as &key (mode :text) [FUNCTION]

Define pronounced-as as the pronunciation for string string. The default is to define this pronunciation for text mode. In general, mode is a keyword symbol that names a pronunciation mode.