[heycam/webidl] Extending an interface with boolean attribute with default value false (#880)

Web Speech API mentions SSML (Speech Synthesis Markup Language) at `text` attribute

https://wicg.github.io/speech-api/#dom-speechsynthesisutterance-text

> **_text_ attribute**, of type [DOMString](https://heycam.github.io/webidl/#idl-DOMString)
>     This attribute specifies the text to be synthesized and spoken for this utterance. This may be either plain text or a complete, well-formed SSML document. [[SSML](https://wicg.github.io/speech-api/#biblio-ssml)] For speech synthesis engines that do not support SSML, or only support certain tags, the user agent or speech engine must strip away the tags they do not support and speak the text. There may be a maximum length of the text, it may be limited to 32,767 characters. 
> 

The specification does not provide a clear description of how to signal to the speech synthesis processing application whether `text` passed to `SpeechSynthesisUtterance` instance or set at or `text` attribute is SSML or text that does not intended to be interpreted and parsed as a markup language https://github.com/WICG/speech-api/issues/10.

Existing speech synthesis engines, and processing interfaces have infrastructure in place to parse SSML https://github.com/brailcom/speechd/issues/301#issuecomment-623228102 within the scope of the language of the existing Web Speech API specification, save for the lack of clear procedural steps to implement signaling to the engine to process `text` as SSML. After filing mutliple issues, including one where the patch to turn of SSML processing on for `speech-dispatcher` (used by Chromium and Firefox for a speech engine interface) sat, and still sits unpatched, decided to implement SSML parsing algorithm, as described in official specification, in JavaScript https://github.com/guest271314/SSMLParser, to demonstrate the request to implement SSML parsing is possible to achieve, and the reason for non-implementation of the specification by browsers is not a technical issue.

The specification states `text` can be SSML, though provides no means to signal the speech synthesis engine directly or through an interface to interpret and parse `text` attribute input as SSML.

The simplest fix that have conceived of so far to have specification language and IDL in place for when the specification authors decide to address the issue is to define a `ssml` attribute on `SpeechSynthesisUtterance`.

Hereafter all of the required elements of implementation will be prepared to be written in a specification in some form and simply turned on in browser source code.

https://wicg.github.io/speech-api/#speechsynthesisutterance

```
[Exposed=Window]
interface SpeechSynthesisUtterance : EventTarget {
    constructor
(optional DOMString text
);

    attribute DOMString text;
    attribute DOMString lang;
    attribute SpeechSynthesisVoice? voice;
    attribute float volume;
    attribute float rate;
    attribute float pitch;
```

The addition being a boolean type with default value set to `false` indicating `text` is not expected to interpreted as SSML without `ssml` attribute set to `true`.

```
    attribute boolean = false
```

The language which would described the `ssml` attribute

> **_ssml_ attribute**, of type `boolean`
>   This attribute, if `true`, signals to the speech synthesis engine to interptet **_text_ attribute** as SSML, default value `false`.

Are the attribute extension in Web IDL language correct and consistent with the language defining the attribute?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/880

Received on Wednesday, 6 May 2020 03:02:21 UTC