Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: SpeechSynthesisUtterance requires lang field, even after setting voice. #37

Open
rbozan opened this issue Jun 22, 2024 · 6 comments
Labels
external-issue Known issues that need to be followed in a third-party issue tracker

Comments

@rbozan
Copy link

rbozan commented Jun 22, 2024

There's one caveat which I noticed with the API on Android, which is that the voice does not work unless the lang property is also set. You can set the lang property to the value of voice.lang and it'll work, but keeping it undefined makes voice not work at all.

@HadrienGardeur HadrienGardeur added the external-issue Known issues that need to be followed in a third-party issue tracker label Jun 22, 2024
@HadrienGardeur
Copy link
Owner

HadrienGardeur commented Jun 22, 2024

Thanks, that's a good catch. I'm also adding that one to the project dedicated to well-known issues. I'll also have to tweak my demo to take this into account.

You can set the lang property to the value of voice.lang and it'll work, but keeping it undefined makes voice not work at all.

Just to clarify that one, by "not work at all", do you mean that it defaults to the system default or that the playback doesn't even start at all?

HadrienGardeur added a commit that referenced this issue Jun 22, 2024
@HadrienGardeur
Copy link
Owner

Also worth mentioning that HadrienGardeur/read-aloud-best-practices#6 remains an issue, in addition to setting up lang on SpeechSynthesisUtterance.

@rbozan
Copy link
Author

rbozan commented Jun 22, 2024

Thanks, that's a good catch. I'm also adding that one to the project dedicated to well-known issues. I'll also have to tweak my demo to take this into account.

You can set the lang property to the value of voice.lang and it'll work, but keeping it undefined makes voice not work at all.

Just to clarify that one, by "not work at all", do you mean that it defaults to the system default or that the playback doesn't even start at all?

Yes I meant that it uses the system default.

What I don't understand is that its stated that voice packs must be installed for the voice to work but I don't think I have installed the voice pack and it still works.

@HadrienGardeur
Copy link
Owner

What I don't understand is that its stated that voice packs must be installed for the voice to work but I don't think I have installed the voice pack and it still works.

Voice packs are pre-loaded for a number of languages by default on Android.

@HadrienGardeur
Copy link
Owner

@rbozan I did some additional testing and you're right, something has changed on Android compared to some of my previous test.

Here's what I did:

  • I uninstalled the Catalan voice pack from system settings
  • I then went to my demo and selected Catalan, and it worked
  • Going back to system settings, this seem to have triggered the download of the Catalan voice pack automatically
  • I went back to the demo and tested again, it read the text with another voice (same voice available in system settings)

I'm running the beta version of Android 15, but this could also be related to a Chrome update. I'll need to do some additional testing, I'm mostly wondering why it fallbacks to another voice when the voice pack is uninstalled.

@rbozan
Copy link
Author

rbozan commented Jun 23, 2024

Thanks a lot for the testing by the way, it helps me a bunch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-issue Known issues that need to be followed in a third-party issue tracker
Projects
Status: Todo
Development

No branches or pull requests

2 participants