Query Speech Service API

 

The goal for the Query Speech Service API is to provide the developer with a runtime capability to query the service, obtain specific information about the features it implements and allow the developer to implement a deterministic user experience.

This API is extremely important in the default service scenario where the developer does not specify what engine, protocol or other parameters they want to use but rather rely on the User Agent to provide that on their behalf.

Based on the result of the query, the developer can display to the user service information and filter UI elements based on the service capabilities implemented by the service.

Standard Capabilities should be represented as individual objects while provider specific capabilities should be represented as Key/Value pairs or a more generic Capability object.

 

Note: Finalization of the capabilities is dependent on the protocol work as those parameters have to be exposed in the API.

 

Interfaces

 

SpeechService Interface – Provides and API to bind to the speech service. Once the service object is instantiated the object acts as a proxy communicating with the speech engine (local or remote)

 

Constants

SPEECH_INITIALIZE – a constant describing that the service is in the process of binding

AVAILABLE – a constant describing that the service is ready to be used by the application

UNAVAILABLE – a constant describing that the service is unavailable.

 

Attributes

 

State – read only attribute representing the current state of the service

Type – read only attribute representing the type of service (TTS, ASR, TTS_ASR)

Api_URI – the uri of the speech engine

displayName – Name of the service as it can be presented to the user

description – detailed description of the service as it can be presented to the user

speechProtocol – speech engine protocol used by the service

 

Note: other attributes to be defined based on the underlining protocol parameters

 

Methods:

bind() – operation that connect to the speech service

unbind() – operation that disconnects from the speech service

 

Example:


        var serviceInstance = 0;
        
        // function that displays the description of the service to the user
        function displayDescription(service) {      
                var description = document.getElementById('speechservice');
                description.value = service.description;
        
        }

        // Connect  function
        function connectToSpeech(service) {     
                serviceInstance = window.querySpeech.ServiceQuery.query();

serviceInstance.bind();
        }

        }

 

WebIDL

 

module querySpeech  {


 [NoInterfaceObject] interface ServiceQuery  {
       SpeechService query(in optional  Criteria filter, in optional QueryOptions options) raises(SpeechException);
        };

 

interface SpeechService {
                const unsigned short  SPEECH_INITIALIZE = 0;             
                const unsigned short AVAILABLE = 1;
                const unsigned short UNAVAILABLE = 2;
               

  readonly attribute unsigned short state;

  readonly attribute SpeechServiceType type;
                attribute DOMString api_URI;
                attribute DOMString displayName;

                  attribute DOMString speechProtocol;
                attribute DOMString description;

                …..


                void bind()  raises(SpeechException);
                void unbind()  raises(SpeechException);
        };

 

[NoInterfaceObject] interface Criteria {     
        };

 

exception SpeechException {
               const unsigned short SPEECH_UNAVAILABLE = 101;

const unsigned short INVALID_PARAMETERS = 102;
        };

 

[NoInterfaceObject] interface SpeechServiceType {
               const unsigned short SPEECH_TTS_ONLY = 101;

const unsigned short  SPEECH_ASR_ONLY = 102;

const unsigned short  SPEECH_TTS_ASR = 103;
        };

 

[NoInterfaceObject] interface QueryOptions {
                 const unsigned short INFINITE = 0;              
                attribute unsigned short timeout;
        };

};