<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>243055</bug_id>
          
          <creation_ts>2022-07-21 07:51:44 -0700</creation_ts>
          <short_desc>REGRESSION: Web Speech API - nullable voice attribute is not supported</short_desc>
          <delta_ts>2022-09-27 16:33:56 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>Safari 15</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>REOPENED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cindy Qi Li">cli</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>cfleizach</cc>
    
    <cc>clown</cc>
    
    <cc>mbrambilla</cc>
    
    <cc>obara.justin</cc>
    
    <cc>sbates</cc>
    
    <cc>sihui_liu</cc>
    
    <cc>tyler_w</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1885689</commentid>
    <comment_count>0</comment_count>
    <who name="Cindy Qi Li">cli</who>
    <bug_when>2022-07-21 07:51:44 -0700</bug_when>
    <thetext>According to Web Speech API (https://wicg.github.io/speech-api/#dom-speechsynthesisutterance-voice): &quot;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.&quot;

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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1885902</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-21 19:13:21 -0700</bug_when>
    <thetext>&lt;rdar://problem/97412545&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1885983</commentid>
    <comment_count>2</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2022-07-22 09:28:11 -0700</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1886008</commentid>
    <comment_count>3</comment_count>
    <who name="Cindy Qi Li">cli</who>
    <bug_when>2022-07-22 10:25:44 -0700</bug_when>
    <thetext>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&apos;t know how to access the nightly build. If it&apos;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 &quot;speak&quot; button.

Nothing was announced.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1886018</commentid>
    <comment_count>4</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2022-07-22 10:55:59 -0700</bug_when>
    <thetext>(In reply to Cindy Qi Li from comment #3)
&gt; Thanks for looking into the issue, Chris.
&gt; 
&gt; I can reproduce the issue with exactly what you did with the same demo: 
&gt; 
&gt; https://codepen.io/matt-west/pen/DpmMgE
&gt; 
&gt; I tested with Safari 15 and Safari Technology Preview for macOS Monterey.
&gt; The issue can be reproduced in both. I don&apos;t know how to access the nightly
&gt; build. If it&apos;s allowed, could you drop me a link to the nightly build so I
&gt; can test there?
&gt; 
&gt; What I did:
&gt; 
&gt; 1. commented out line 74 in the js code;
&gt; 2. clicked another pane so the page panel re-rendered;
&gt; 3. input a sentence in the text field, clicked &quot;speak&quot; button.
&gt; 
&gt; Nothing was announced.

Try here

Thanks

https://webkit.org/build-archives/#mac-monterey-x86_64%20arm64</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1886494</commentid>
    <comment_count>5</comment_count>
    <who name="Cindy Qi Li">cli</who>
    <bug_when>2022-07-25 06:46:51 -0700</bug_when>
    <thetext>When starting the nightly build by running `run-webkit-archive`, I hit a number of &quot;authorization denied&quot; 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 &quot;authorization denied&quot;

Failed to open AutoFill corrections SQLite store at CloudAutoFillCorrections.db. Error: Error Domain=com.apple.Safari.SQLite Code=23 &quot;authorization denied&quot;

...
```

The nightly build did start at the end though. The codepen demo still didn&apos;t work when line 74 was commented out. It did work with line 74 in place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897054</commentid>
    <comment_count>6</comment_count>
    <who name="Justin O">obara.justin</who>
    <bug_when>2022-09-08 09:23:47 -0700</bug_when>
    <thetext>I tried this with the latest Safari Tech Preview, Release 153 (Safari 16.0, WebKit 17615.1.4.1). It still isn&apos;t working. I also tested using the codepen that was mentioned, with line 74 commented out, and could still reproduce the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897060</commentid>
    <comment_count>7</comment_count>
    <who name="Tyler Wilcock">tyler_w</who>
    <bug_when>2022-09-08 10:36:15 -0700</bug_when>
    <thetext>(In reply to Justin O from comment #6)
&gt; I tried this with the latest Safari Tech Preview, Release 153 (Safari 16.0,
&gt; WebKit 17615.1.4.1). It still isn&apos;t working. I also tested using the codepen
&gt; that was mentioned, with line 74 commented out, and could still reproduce
&gt; 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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897061</commentid>
    <comment_count>8</comment_count>
    <who name="Justin O">obara.justin</who>
    <bug_when>2022-09-08 10:45:04 -0700</bug_when>
    <thetext>(In reply to Tyler Wilcock from comment #7)
&gt; (In reply to Justin O from comment #6)
&gt; &gt; I tried this with the latest Safari Tech Preview, Release 153 (Safari 16.0,
&gt; &gt; WebKit 17615.1.4.1). It still isn&apos;t working. I also tested using the codepen
&gt; &gt; that was mentioned, with line 74 commented out, and could still reproduce
&gt; &gt; the issue.
&gt; 
&gt; I downloaded STP 153 and I also cannot reproduce the issue following the
&gt; same steps from comment 2:
&gt; 
&gt; https://bugs.webkit.org/show_bug.cgi?id=243055#c2
&gt; 
&gt; When I comment out line 74, I hear the phrase spoken in the default en-US
&gt; voice.
&gt; 
&gt; I see Cindy was reproducing this issue on Monterey. Are you also running
&gt; Monterey, Justin?
&gt; 
&gt; 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 &quot;testing&quot; 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 &quot;testing&quot; and leave all the default settings again. This time pressing the Speak button doesn&apos;t read anything out.

I&apos;m using macOS Monterey (12.5.1).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897066</commentid>
    <comment_count>9</comment_count>
    <who name="Simon Bates">sbates</who>
    <bug_when>2022-09-08 11:21:10 -0700</bug_when>
    <thetext>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(&quot;hello&quot;))

Expected:

* To hear &quot;hello&quot; spoken

Actual:

* Nothing heard

When I run the JavaScript command above (window.speechSynthesis.speak(new SpeechSynthesisUtterance(&quot;hello&quot;))) on Firefox and Chrome on the same computer, I hear &quot;hello&quot; 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(&quot;hello&quot;);
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 &quot;en-CA&quot; for me

Thanks very much for looking into this issue.

Regards,
Simon</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898523</commentid>
    <comment_count>10</comment_count>
    <who name="Matthew Brambilla">mbrambilla</who>
    <bug_when>2022-09-14 13:16:28 -0700</bug_when>
    <thetext>MacOS Monterey v12.6
Safari v16.0

Using the speech command in console:
window.speechSynthesis.speak(new SpeechSynthesisUtterance(&quot;hello&quot;))

- 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1899898</commentid>
    <comment_count>11</comment_count>
    <who name="Simon Bates">sbates</who>
    <bug_when>2022-09-20 12:01:50 -0700</bug_when>
    <thetext>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&apos;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&apos;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 =&gt; voice.lang).filter(lang =&gt; lang.startsWith(&quot;en&quot;)).sort()

I get these 11 voices for English:

- &quot;en-AU&quot;
- &quot;en-GB&quot;
- &quot;en-IE&quot;
- &quot;en-IN&quot;
- &quot;en-IN&quot;
- &quot;en-SCOTLAND&quot;
- &quot;en-US&quot;
- &quot;en-US&quot;
- &quot;en-US&quot;
- &quot;en-US&quot;
- &quot;en-ZA&quot;

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 &quot;Language &amp; Region&quot;
3. Check in the terminal: defaults read -g AppleLanguages
4. Start Safari
5. Run in Safari: window.speechSynthesis.speak(new SpeechSynthesisUtterance(&quot;hello world&quot;))

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901533</commentid>
    <comment_count>12</comment_count>
    <who name="Cindy Qi Li">cli</who>
    <bug_when>2022-09-27 08:55:11 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901534</commentid>
    <comment_count>13</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2022-09-27 08:56:25 -0700</bug_when>
    <thetext>(In reply to Cindy Qi Li from comment #12)
&gt; In the last 2 comments, Simon and Mattew provided detail steps of how to
&gt; reproduce this problem. The issue occurs when a matched voice does not exist
&gt; for the region/locale that the computer uses.
&gt; 
&gt; The latest Safari versions that have been tested are Safari Tech Preview 153
&gt; and Safari 16. The issue still exists.

This is a bug in the OS. We can&apos;t fix it in WebKit. Can you test on the latest Ventura?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901541</commentid>
    <comment_count>14</comment_count>
    <who name="Cindy Qi Li">cli</who>
    <bug_when>2022-09-27 09:07:14 -0700</bug_when>
    <thetext>Thanks for the quick reply, Chris.

I&apos;m worried about the risk of breaking my system by installing a beta OS version. Could you follow steps that Simon provided and test?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901641</commentid>
    <comment_count>15</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2022-09-27 16:33:56 -0700</bug_when>
    <thetext>(In reply to Cindy Qi Li from comment #14)
&gt; Thanks for the quick reply, Chris.
&gt; 
&gt; I&apos;m worried about the risk of breaking my system by installing a beta OS
&gt; version. Could you follow steps that Simon provided and test?

I&apos;m testing beta 8 with macOS Ventura and it seems to work. I hear Samantha speak when I do this

-------------
&gt; window.navigator.language
&lt; &quot;en-CA&quot;
&gt; window.speechSynthesis.speak(new SpeechSynthesisUtterance(&quot;hello world&quot;))
&lt; undefined
---------------</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>