Re: TTS proposal to split Utterance into its own interface

Yes, I like the way you've defined the "speak" method to not change the
play/pause state. Also, I didn't particularly like the word "playback", so
thanks for the alternative "spoken".  Here's updated definitions with your
suggestions incorporated. If there's no disagreement, I'll add them to the
spec on Monday.


SpeechSynthesis Attributes

pending attribute:
This attribute is true if the queue for this SpeechSynthesis
object contains any utterances which have not started speaking.

speaking attribute:
This attribute is true if an utterance is being spoken. Specifically if an
utterance has begun being spoken and has not completed being spoken, and is
independent of whether this SpeechSynthesis object is in the paused state.

paused attribute:
The attribute is true when this SpeechSynthesis object is in the paused
state. This state is independent of whether anything is in the queue. The
default state of a new SpeechSynthesis object is the non-paused state.


SpeechSynthesis Methods

The speak method
This method appends the utterance to the end of the queue for
this SpeechSynthesis object. It does not change the paused state of
the SpeechSynthesis object.  If the SpeechSynthesis object is paused, it
remains paused. If it is not paused, then this utterance is spoken if no
other utterances are in the queue, else this utterance is queued to begin
speaking after the other utterances in the queue have been spoken.

The cancel method
This method removes the specified utterance from the queue. If it is not in
the queue, no changes are made. If the utterance removed is being spoken,
speaking ceases for that utterance and the next utterance in the queue (if
any) begins to be spoken. This method does not change the paused state of
the SpeechSynthesis object.

The pause method
This method puts the SpeechSynthesis object into the paused state. If an
utterance was being spoken, it pauses mid-utterance. (If called
when the SpeechSynthesis object was already in the paused state, it does
nothing.)

The continue method
This method puts the SpeechSynthesis object into the non-paused state. If
an utterance was speaking (that is, its speaking attribute is true), it
continues speaking the utterance at the point at which it was paused, else
it begins speaking the next utterance in the queue (if any). (If called
when the SpeechSynthesis object was already in the non-paused state, it
does nothing.)

The stop method.
This method puts the SpeechSynthesis object into the paused state and
flushes the queue. It sets the speaking attribute to false and the paused
attribute to true.


SpeechSynthesisUtterance attributes


[[Note, I used SHOULD here because there may be some race-condition
edge-cases where it might not be ignored.]]

text attribute:
The text to be synthesized for this utterance. Changes to this attribute
after the utterance has been added to the queue (by calling the speak
method) SHOULD be ignored.

lang attribute:
[no change except to append the following] Changes to this attribute after
the utterance has been added to the queue (by calling the speak method)
SHOULD be ignored.

serviceURI attribute:
[no change except to append the following] Changes to this attribute after
the utterance has been added to the queue (by calling the speak method)
SHOULD be ignored.

speaking attribute:
This attribute is true if this specific utterance is currently being
spoken. Specifically if this utterance has begun being spoken and has not
completed being spoken. This is independent of whether
the SpeechSynthesis object is in a paused state.

paused attribute:
This attribute is true if this specific utterance has begun to be spoken,
but has not completed and the SpeechSynthesis object is in the paused state.

ended attribute:
This attribute is true if this specific utterance has completed being
spoken.

SpeechSynthesisUtterance events

onstart event:
Fired when this utterance has begun to be spoken.

onend event:
Fired when this utterance has completed being spoken.



On Thu, Sep 13, 2012 at 10:25 AM, Dominic Mazzoni <dmazzoni@google.com>wrote:

> Thanks for proposing definitions.
>
> On Tue, Sep 11, 2012 at 3:02 AM, Glen Shires <gshires@google.com> wrote:
> > I propose the following definitions for the SpeechSynthesis IDL:
> >
> > SpeechSynthesis Attributes
> >
> > pending attribute:
> > This attribute is true if the queue contains any utterances which have
> not
> > completed playback.
>
> I was imagining: This attribute is true if the queue contains any
> utterances which have not *started* speaking.
>
> > speaking attribute:
> > This attribute is true if playback is in progress.
>
> I don't like the word "playback", it doesn't fit when the speech is
> generated dynamically. How about: This attribute is true if an
> utterance is being spoken.
>
> > paused attribute:
> >   **** How is this different than (pending && !speaking) ? ****
>
> This is true if the speech synthesis system is in a paused state,
> independent of whether anything is speaking or queued.
>
> paused && speaking -> it was paused in the middle of an utterance
> paused && !speaking -> no utterance is speaking, but if you call
> speak(), nothing will happen because it's in a paused state.
>
> >
> > SpeechSynthesis Methods
> >
> > The speak method
> > This method appends the utterance to the end of a playback queue. If
> > playback is not in progress, it also begins playback of the next item in
> the
> > queue.
>
> What do you think about rewriting to not use "playback"?
>
> Also, my idea was that it would not begin playback if the system is in
> a paused state.
>
> > The cancel method
> > This method removes the first matching utterance (if any) from the
> playback
> > queue. If playback is in progress and the utterance removed is being
> played,
> > playback ceases for the utterance and the next utterance in the queue (if
> > any) begins playing.
>
> Do we need to say "first matching"? Each utterance should be a
> specific object, it should be either in the queue or not.
>
> > The pause method
> > This method pauses the playback mid-utterance. If playback is not in
> > progress, it does nothing.
>
> I was assuming that calling it would set the system into a paused
> state, so that even a subsequent call to speak() would not do anything
> other than enqueue.
>
> > The continue method
> > This method continues the playback at the point in the utterance and
> queue
> > in which it was paused.  If playback is in progress, it does nothing.
> >
> > The stop method.
> > This method stops playback mid-utterance and flushes the queue.
> >
> >
> > SpeechSynthesisUtterance attributes
> >
> > text attribute:
> > The text to be synthesized for this utterance. This attribute must not be
> > changed after onstart fires.
>
> I'd say: changes to this attribute after the utterance has been added
> to the queue (by calling "speak") will be ignored. OR, we should make
> it a DOM exception to modify it when it's in the speech queue.
>
> > paused attribute:
> > This attribute is true if this specific utterance is in the queue and has
> > not completed playback.
>
> I think this should only be true if it has begin speaking but not
> completed.
>
> - Dominic
>

Received on Thursday, 13 September 2012 21:15:06 UTC