REOPENED 243055
REGRESSION: Web Speech API - nullable voice attribute is not supported
https://bugs.webkit.org/show_bug.cgi?id=243055
Summary REGRESSION: Web Speech API - nullable voice attribute is not supported
Cindy Qi Li
Reported 2022-07-21 07:51:44 PDT
According to Web Speech API (https://wicg.github.io/speech-api/#dom-speechsynthesisutterance-voice): "If the voice attribute is unset or null at the time of the speak() method call, then the user agent must use a user agent default voice." However with the latest Safari, when the voice attribute is null, the speech synthesis stops immediately without speaking. This feature was supported in older versions of Safari.
Attachments
Radar WebKit Bug Importer
Comment 1 2022-07-21 19:13:21 PDT
chris fleizach
Comment 2 2022-07-22 09:28:11 PDT
With the latest Safari Nightly build I cannot reproduce this I went to https://codepen.io/matt-west/pen/DpmMgE commented out line 74 in the JS so no voice is selected I pressed speak and en-US was used to speak the sentence. Please provide a test case if you can reproduce
Cindy Qi Li
Comment 3 2022-07-22 10:25:44 PDT
Thanks for looking into the issue, Chris. I can reproduce the issue with exactly what you did with the same demo: https://codepen.io/matt-west/pen/DpmMgE I tested with Safari 15 and Safari Technology Preview for macOS Monterey. The issue can be reproduced in both. I don't know how to access the nightly build. If it's allowed, could you drop me a link to the nightly build so I can test there? What I did: 1. commented out line 74 in the js code; 2. clicked another pane so the page panel re-rendered; 3. input a sentence in the text field, clicked "speak" button. Nothing was announced.
chris fleizach
Comment 4 2022-07-22 10:55:59 PDT
(In reply to Cindy Qi Li from comment #3) > Thanks for looking into the issue, Chris. > > I can reproduce the issue with exactly what you did with the same demo: > > https://codepen.io/matt-west/pen/DpmMgE > > I tested with Safari 15 and Safari Technology Preview for macOS Monterey. > The issue can be reproduced in both. I don't know how to access the nightly > build. If it's allowed, could you drop me a link to the nightly build so I > can test there? > > What I did: > > 1. commented out line 74 in the js code; > 2. clicked another pane so the page panel re-rendered; > 3. input a sentence in the text field, clicked "speak" button. > > Nothing was announced. Try here Thanks https://webkit.org/build-archives/#mac-monterey-x86_64%20arm64
Cindy Qi Li
Comment 5 2022-07-25 06:46:51 PDT
When starting the nightly build by running `run-webkit-archive`, I hit a number of "authorization denied" errors such as: ``` Failed to open cache settings store at file:///.../Safari/Touch%20Icons%20Cache/TouchIconCacheSettings.db: Error Domain=com.apple.Safari.SQLite Code=23 "authorization denied" Failed to open AutoFill corrections SQLite store at CloudAutoFillCorrections.db. Error: Error Domain=com.apple.Safari.SQLite Code=23 "authorization denied" ... ``` The nightly build did start at the end though. The codepen demo still didn't work when line 74 was commented out. It did work with line 74 in place.
Justin O
Comment 6 2022-09-08 09:23:47 PDT
I tried this with the latest Safari Tech Preview, Release 153 (Safari 16.0, WebKit 17615.1.4.1). It still isn't working. I also tested using the codepen that was mentioned, with line 74 commented out, and could still reproduce the issue.
Tyler Wilcock
Comment 7 2022-09-08 10:36:15 PDT
(In reply to Justin O from comment #6) > I tried this with the latest Safari Tech Preview, Release 153 (Safari 16.0, > WebKit 17615.1.4.1). It still isn't working. I also tested using the codepen > that was mentioned, with line 74 commented out, and could still reproduce > the issue. I downloaded STP 153 and I also cannot reproduce the issue following the same steps from comment 2: https://bugs.webkit.org/show_bug.cgi?id=243055#c2 When I comment out line 74, I hear the phrase spoken in the default en-US voice. I see Cindy was reproducing this issue on Monterey. Are you also running Monterey, Justin? Are there any specific phrases that cause this issue?
Justin O
Comment 8 2022-09-08 10:45:04 PDT
(In reply to Tyler Wilcock from comment #7) > (In reply to Justin O from comment #6) > > I tried this with the latest Safari Tech Preview, Release 153 (Safari 16.0, > > WebKit 17615.1.4.1). It still isn't working. I also tested using the codepen > > that was mentioned, with line 74 commented out, and could still reproduce > > the issue. > > I downloaded STP 153 and I also cannot reproduce the issue following the > same steps from comment 2: > > https://bugs.webkit.org/show_bug.cgi?id=243055#c2 > > When I comment out line 74, I hear the phrase spoken in the default en-US > voice. > > I see Cindy was reproducing this issue on Monterey. Are you also running > Monterey, Justin? > > Are there any specific phrases that cause this issue? Thanks for looking at this. I just tried again and can still reproduce the issue. I go to the codepen ( https://codepen.io/matt-west/pen/DpmMgE ). Type in the phrase "testing" and leave all the other settings at the default with the Alex Voice. It reads out testing. I go to the JS tab and comment out line 74 and wait for the pen to updated. I re-enter "testing" and leave all the default settings again. This time pressing the Speak button doesn't read anything out. I'm using macOS Monterey (12.5.1).
Simon Bates
Comment 9 2022-09-08 11:21:10 PDT
Hi, I am experiencing this issue also. I can reproduce the issue with the following steps: 1. Open Safari Technology Preview 153 (additional OS details below) 2. Open the developer Console 3. Run the following: window.speechSynthesis.speak(new SpeechSynthesisUtterance("hello")) Expected: * To hear "hello" spoken Actual: * Nothing heard When I run the JavaScript command above (window.speechSynthesis.speak(new SpeechSynthesisUtterance("hello"))) on Firefox and Chrome on the same computer, I hear "hello" being spoken. I am able to get speech to work if I explicitly set the voice before sending the utterance to the speak method. If I run the following on the Safari Technology Preview 153, I am able to hear speech: u = new SpeechSynthesisUtterance("hello"); u.voice = window.speechSynthesis.getVoices()[0]; window.speechSynthesis.speak(u); Machine details: * macOS 12.5.1 * Intel MacBook Pro * I am in Canada (maybe there is a locale component to this?) and window.navigator.language is "en-CA" for me Thanks very much for looking into this issue. Regards, Simon
Matthew Brambilla
Comment 10 2022-09-14 13:16:28 PDT
MacOS Monterey v12.6 Safari v16.0 Using the speech command in console: window.speechSynthesis.speak(new SpeechSynthesisUtterance("hello")) - Open a fresh tab (and go to some website) with my system locale set to `en-US` the speech command works. Then change the system to `en-CA` locale, the speech stops working and will not work on that tab again. - Keep the system locale set to `en-CA` and open a fresh tab and go to a site, the speech command does not work at all. - Set system locale back to `en-US` , new tab and site, speech works again.
Simon Bates
Comment 11 2022-09-20 12:01:50 PDT
I have been doing a little more testing and I am seeing a correlation between Safari speaking when the utterance voice is null and the availability of a voice that matches the user's locale. When a voice is available, Safari will speak an utterance with a null voice. But when a voice is not available, Safari will not speak. My theory is that only people in countries for which there isn't a matching voice will be affected by this bug. Which I think explains why it has been hard to reproduce. When I evaluate the following expression on my MacBook in Safari 16: window.speechSynthesis.getVoices().map(voice => voice.lang).filter(lang => lang.startsWith("en")).sort() I get these 11 voices for English: - "en-AU" - "en-GB" - "en-IE" - "en-IN" - "en-IN" - "en-SCOTLAND" - "en-US" - "en-US" - "en-US" - "en-US" - "en-ZA" When I set my region to one of these countries, Safari will speak. But for other countries, it will not. Test method: 1. Quit Safari 2. Set my region in the System Preferences "Language & Region" 3. Check in the terminal: defaults read -g AppleLanguages 4. Start Safari 5. Run in Safari: window.speechSynthesis.speak(new SpeechSynthesisUtterance("hello world")) Results: Region AppleLanguages speaks? ------ -------------- ------- Australia en-AU yes UK en-GB yes Ireland en-IE yes India en-IN yes US en-US yes South Africa en-ZA yes Canada en-CA no New Zealand en-NZ no Jamaica en-JM no
Cindy Qi Li
Comment 12 2022-09-27 08:55:11 PDT
In the last 2 comments, Simon and Mattew provided detail steps of how to reproduce this problem. The issue occurs when a matched voice does not exist for the region/locale that the computer uses. The latest Safari versions that have been tested are Safari Tech Preview 153 and Safari 16. The issue still exists.
chris fleizach
Comment 13 2022-09-27 08:56:25 PDT
(In reply to Cindy Qi Li from comment #12) > In the last 2 comments, Simon and Mattew provided detail steps of how to > reproduce this problem. The issue occurs when a matched voice does not exist > for the region/locale that the computer uses. > > The latest Safari versions that have been tested are Safari Tech Preview 153 > and Safari 16. The issue still exists. This is a bug in the OS. We can't fix it in WebKit. Can you test on the latest Ventura?
Cindy Qi Li
Comment 14 2022-09-27 09:07:14 PDT
Thanks for the quick reply, Chris. I'm worried about the risk of breaking my system by installing a beta OS version. Could you follow steps that Simon provided and test?
chris fleizach
Comment 15 2022-09-27 16:33:56 PDT
(In reply to Cindy Qi Li from comment #14) > Thanks for the quick reply, Chris. > > I'm worried about the risk of breaking my system by installing a beta OS > version. Could you follow steps that Simon provided and test? I'm testing beta 8 with macOS Ventura and it seems to work. I hear Samantha speak when I do this ------------- > window.navigator.language < "en-CA" > window.speechSynthesis.speak(new SpeechSynthesisUtterance("hello world")) < undefined ---------------
Note You need to log in before you can comment on or make changes to this bug.