Share via


prompt Element

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Specifies the content of audio output.

Syntax

<prompt attributes>
    <param attributes />    // Custom configuration (optional)
    prompt text
    <content attributes />  // References external output resources 
    prompt text
    <value attributes />    // Associates values from page elements
</prompt>

Members

The prompt element consists of the following members.

Content Description

param

Specifies a configuration parameter for Speech Server.

content

Refers to an external output resource.

value

Retrieves the value of an element in an HTML document.

Inline prompt content

Specifies inline prompt content.

Attribute Description

bargein

Specifies whether the prompt is cut off when the user speaks or dual tone multi-frequency (DTMF) input is received. Optional.

id

Uniquely identifies the prompt element.

prefetch

Specifies whether the prompt should be fetched (for remote files) or synthesized immediately and cached when the page is loaded. Optional.

xmlns

Declares a namespace and identifies the schema of the format. Optional.

xml:lang

Specifies the language to which the prompt refers. Optional.

Property Description

status

Returns the status code from the last operation. Read-only.

Method Description

Queue

Queues the prompt onto the prompt subqueue.

Start

Starts prompt playback.

Event Description

onbargein

Occurs when prompt playback is still in progress and when an input event is detected by sound, DTMF input, or speech from the user.

oncomplete

Occurs when the prompt playback ends successfully.

onerror

Occurs when a serious or fatal error occurs with the text-to-speech (voice output) process.

Remarks

A prompt is content spoken to the user. Prompts can perform a variety of tasks. For example, a prompt can:

  • Provide instructions, such as telling users how to proceed.
  • Confirm actions (repeating input parameters that the user has spoken so the user has an opportunity to confirm or correct selections).
  • Read text.
  • Greet users.

The prompt element contains resources for speech output. Spoken content is supplied as text, audio files, or both. Text content exists as plain text or XML content that is enhanced with Speech Synthesis Markup Language (SSML) markup.

Any number of prompt elements can be declared on a page and any prompt can be used more than once. However, a separate prompt element should be declared for each unique purpose in a prompt. In other words, create a separate prompt element for each separate item that needs to be spoken to the user. For example, a page might only need one prompt for all speaking purposes. The following prompt could be declared for a page.

<salt:prompt id="Prompt1">Please say your name, last name first</salt:prompt>

If it is determined later that even a single instance of the prompt needs an additional attribute, such as adding an oncomplete event-handler, declare another prompt. Existing prompts cannot be programmatically modified after declaration to include new attributes or delete existing ones. The following declaration is a new prompt element for the page and includes the oncomplete event.

<salt:prompt id="Prompt2" oncomplete="doCompleted()" >Please say your name, last name first</salt:prompt>

Because the purpose of prompts is to speak back to the user, the content of that speech must be specified. There are four ways to specify this prompt text:

  • Inline text. Inline text is specified in the prompt element definition. If parameter text is not present when calling the Start method, text that is declared inline in the prompt element declaration is used. The following example demonstrates a simple case.

    <salt:prompt id="Welcome"> 
        Thank you for calling ACME weather report.
    </prompt>
    
  • Referenced prompt. Another method to generate prompt speech is to use an external source file. The source file can be either a text-only file or an audio file. If the source file contains only text, the entire file content is spoken to the user. An audio file, however, is played for the user. The path to a referenced path can be relative to the current directory or an absolute path to the file. The prompts can exist on a different server, and as long as a network connection is established, the source file can be accessed. The following example opens a text file named Welcome.ssml.

    <salt:prompt id="Prompt1">
        <salt:content type="application/ssml+xml" href="welcome.ssml" />
    </salt:prompt>
    

    The following example uses a .wav audio file. The behavior of the page is identical to that of the preceding example except that the referenced prompt is an audio file.

    <salt:prompt id="Prompt1">
        <salt:content type="audio/wav" href="http://localhost/hello.wav" />
    </salt:prompt>
    
  • Prompt database. The prompt database is the audio collection used by the speech engines. Rather than synthesizing speech, the database manages a collection of custom-recorded .wav files. Individual files can be long, depending on the needs of the speech application developer. Individual files can be concatenated to produce the necessary prompts. Speech Control Editor simplifies recording, editing, and managing prompts in the prompt database.
    When using a prompt database on a SALT page, it is necessary to define the PromptEngine workspace with an xmlns attribute, as shown in the following example.

    <html xmlns:salt="http://www.saltforum.org/2002/SALT"
        xmlns:pe="http://schemas.microsoft.com/Speech/2003/03/PromptEngine">
         ...
        <salt:prompt id="Prompt1">
            <pe:prompt_output>
                <pe:database fname="http://cpandl.com/Prompts/SpeechApps.prompts" />
                Welcome to City Power and Light.
            </pe:prompt_output>
        </salt:prompt>
        ...
    </html>
    

    A collection of prerecorded audio prompts can be put into a database and referenced within that database.

  • Parameter text. Simple prompts need to specify only the text required for output. By default, the parameter text of the Start method is determined first. Any text that is present as a parameter is used as the prompt. The text string can be hard coded by using a string literal. The following code demonstrates a literal prompt used as the parameter text.

    Prompt1.start("Thank you for calling ACME weather report.");
    

    The prompt can also be a string variable that is assigned a value before use. Using a variable, the actual content of the prompt can change on the client just before its use. To confirm a particular value, for example, the value needs to be dereferenced into a variable. Use the value element for this purpose. Though not technically considered a dynamic allocation, a variable provides a robust method for changing text while the application is running.

The prompt elements can be played individually and, in more complex applications, managed through prompt queuing. Prompts are queued and played in subqueues. In Microsoft Internet Explorer, subqueue manipulation is available by using the PromptQueue object.

See Also

Concepts

dtmf Element
listen Element
PromptQueue Object
smex Element