phetsims / utterance-queue

Alerting library powered by aria-live
MIT License
0 stars 2 forks source link

Add Utterance.announcerOptions.voice to SpeechSynthesisAnnouncer #109

Closed zepumph closed 1 year ago

zepumph commented 1 year ago

This will make number-suite speaking much nicer. We have lots of code that needs to listen for the completion of speech to then set back the Announcer.voiceProperty.

Basically it looks like:

    speechSynthUtterance.voice = utterance.announcerOptions.voice || this.voiceProperty.value;

Let's add unit tests too!

Tagging @jessegreenberg. It is pretty simple code changes, but let me know if you want it to behave a certain way.

jessegreenberg commented 1 year ago

Yep, sounds great! Thanks.

zepumph commented 1 year ago

@jessegreenberg can you please spot check the commit above. @chrisklus and I spent most of the time trying to write a test for it, and really like how we got to a spot for UtteranceQueueTests where when you click in it, it will actually speak (but you don't need to click for it to work)

chrisklus commented 1 year ago

This was a big help over in https://github.com/phetsims/number-suite-common/issues/62! See the commit https://github.com/phetsims/number-suite-common/commit/f974c5b3beff347f4887008cf5bafa8687cd1ff2, especially the change in NumberSuiteCommonUtteranceQueue.testVoiceBySpeaking.

jessegreenberg commented 1 year ago

Thanks @zepumph @chrisklus, change to SpeechSynthesisAnnouncer looks good. I like the use of async in the tests this instead of timeouts/intervals.