Ghorthalon / audiogame-tools

Tools for providing audio game-like experiences in the web browser
MIT License
9 stars 4 forks source link

Adding Features to the TTS Module #1

Open frastlin opened 2 years ago

frastlin commented 2 years ago

Hello, Here are some features our team would like the TTS module to have:

  1. [ ] Allow us to register a custom component that can show text that is being spoken visually.
  2. [ ] There should be a way to force tts or screen reader with the speak function. Sometimes I will want to send a particular message through TTS, especially if holding down the arrow keys and I want a message to play. This could be part of an options object passsed to the speak function { forceTTS: true}.
  3. [ ] The default element line 17 in aria.ts should have the attribute aria-atomic="true".
  4. [ ] Make the aria element invisible visually, and instead make the visual output a separate element.
  5. [ ] Create a stop method for the web TTS that doesn't error when there is screen reader or no speech.
  6. [ ] Have a promise for the web TTS that resolves when the speech finishes. The screen reader won't have a time, but maybe there can be a number of time that can be passed to speak to wait for the promise if it's a screen reader.
  7. [ ] Have a way to easily configure and access web TTS options through functions.
  8. [ ] Have an HTML element that can be used to configure the text to speech.
  9. [ ] Allow a JSON config to be exported of the current settings, and allow a JSON config to be loaded again with settings.
  10. [ ] Allow the default method of speech to be toggled between screen reader and text to speech with a method.
frastlin commented 2 years ago

@Ghorthalon Is there a reason for having aria-live="polite" on both the container and display element? Also, the problem with making the aria element visible is that text won't show if the tts is playing. Is there another reason for this element to be visible visually?

Ghorthalon commented 2 years ago

Hi @frastlin

There is no reason it's visible. You can hide it if you like, as long as it's still being read.

I set polite on both since there was some issue with VoiceOver on Mac not reading the contents of the container if both weren't set. I can try this again if this has since been fixed, and if it has, polite only needs to be set on one of them. I'll get back to you on this.