Re: Proposal to add start, stop, and update events to TTS

Glen,

This is great.  Thanks to you and Dominic for sorting out the TTS events portion of the specification. Based on the latest spec, I think it allows us to support the APIs necessary for our Benespeak (https://github.com/benetech/benespeak) library to work with any browser that implements the proposed Speech API.  We have integrated Benespeak into the open source Readium<http://readium.org> EPUB 3 web reader and have released it as a private beta.  You can see how it works in Chrome in the following video:

http://www.youtube.com/watch?v=2juydxvswMI

This type of user experience is going to do wonders for kids with learning disabilities, such as dyslexia, that benefit from multi-modal reading experiences.

Thank You,

Gerardo

Gerardo Capiel
VP of Engineering, Benetech<http://benetech.org/>
650-644-3405
Twitter: @gcapiel<http://twitter.com/gcapiel>
Fork, Code, Do Social Good: http://benetech.github.com/

On Oct 5, 2012, at 9:34 AM, Glen Shires <gshires@google.com<mailto:gshires@google.com>> wrote:

Good point, I agree that the Event object "type" attribute can and should be used for this purpose, so I've done that below.  Dominic has said that it's useful to combine boundary events because different TTS engines provide different capabilities, so capturing them all in a single function is useful, so I've also done that below with an onboundary event.  So here's that slight update, if there's no disagreement, I'll update the spec with this on Monday.

    interface SpeechSynthesisUtterance {
        ...
        attribute Function onstart;
        attribute Function onend;
        attribute Function onpause;
        attribute Function onresume;
        attribute Function onmark;
        attribute Function onboundary;
    };

    interface SpeechSynthesisEvent : Event {
        readonly attribute unsigned long charIndex;
        readonly attribute double elapsedTime;
        readonly attribute DOMString name;
    };

name attribute
  For onmark events, returns the name of the marker, as defined in SSML as the name attribute of a mark element. [SSML] For onboundary events, returns the type of boundary that caused the event: "word" or "sentence".  For all other events, this value should return undefined.

/Glen Shires


On Fri, Oct 5, 2012 at 2:41 AM, Hans Wennborg <hwennborg@google.com<mailto:hwennborg@google.com>> wrote:
On Fri, Oct 5, 2012 at 1:27 AM, Glen Shires <gshires@google.com<mailto:gshires@google.com>> wrote:
> Instead of the callbacks, I propose this cleaner, more extensible IDL (which
> is similar in style to SpeechRecognition).  This also has the benefit that
> if a web author wanted to, he could write a single function to handle all of
> the events (by assigning each event that he was interested in handling to
> that function).
>
> The definitions and functionality don't change.  If there's no disagreement,
> I'll update the spec with this on Monday.
>
>
> All the SpeechSynthesisUtterance events would be simple Functions with a
> SpeechSynthesisEvent object, and that object contains all the attributes
> (and supports future extensibility):
>
>     interface SpeechSynthesisUtterance {
>         ...
>         attribute Function onstart;
>         attribute Function onend;
>         attribute Function onpause;
>         attribute Function onresume;
>         attribute Function onupdate;
>     };
>
>     interface SpeechSynthesisEvent : Event {
>         readonly attribute EventType eventType;
>         readonly attribute double elapsedTime;
>         readonly attribute unsigned long charIndex;
>         readonly attribute DOMString name;
>     };
>
>     enum EventType { "start", "stop", "pause", "resume", "mark", "word",
> "sentence" };

Sorry, I haven't been following this discussion very closely, but I'm
worried about the 'eventType' attribute.

An Event object already has a 'type' attribute, and I think it would
be confusing to add another one.

I think it's better to have separate event handlers, something like:

  attribute Function onstart;
  attribute Function onend;
  attribute Function onpause;
  attribute Function onresume;
  attribute Function onmark;
  attribute Function onwordboundary;
  attribute Function onsentence;

And if the developer wants to use the same function for all of them,
he can just check the 'type' attribute to see what kind of event it
was (start, end, pause, resume, mark, wordbounary, or sentence).

Thanks,
Hans

Received on Sunday, 7 October 2012 22:54:43 UTC