Open Bug 1541330 Opened 6 years ago Updated 3 years ago

Speech Synthesis play incorrect

Categories

(Core :: Web Speech, defect, P3)

65 Branch
defect

Tracking

()

People

(Reporter: karlcow, Unassigned)

References

()

Details

(Whiteboard: [webcompat])

This is https://webcompat.com/issues/27221

and here what the reporter said:

I wrote a simple javascript as below.
when I set lang = 'cmn' (Mandarin Chinese).
it works well in firefox for Android, or Chrome mobile and desktop versions.
however, in firefox desktop version for Ubuntu 18, the speech is unrecognizable.

=========== java script Begin =================
function Sayit() {
let u = new SpeechSynthesisUtterance();
u.lang = 'cmn';
u.text = "早安";
speechSynthesis.speak(u);
}
=========== java script End =================

<details>
<summary>Browser Configuration</summary>
<ul>
<li>None</li>
</ul>

</details>

Reported by @stevene29f

Flags: webcompat?

Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.

Webcompat Priority: --- → ?

See bug 1547409. Migrating whiteboard priority tags to program flags.

This script doesn't work in both Firefox and Chrome on my OSX.
The problem in Firefox is that we couldn't find a match for lang = cmn. In that case, we will use a locale lang to synthesize voice for speaking.
It can be verified by enabling the log: $ MOZ_LOG="SpeechSynthesis:5" ./mach run. In my case I saw:

[Parent 9252: Main Thread]: D/SpeechSynthesis nsSynthVoiceRegistry::FindBestMatch - Matched UI language (en-US ~= en-US)
[Parent 9252: Main Thread]: D/SpeechSynthesis nsSynthVoiceRegistry::SpeakImpl queueing text='早安' uri='urn:moz-tts:osx:com.apple.speech.synthesis.voice.Alex' rate=1.000000 pitch=1.000000

Chaning the cmn to zh-cmn works for me.

However, it seems that cmn is valid by the spec. cmn should be a valid BCP 47 language tag.

If I run this script in Chrome or Firefox, the result is the same (neither of which sound like Mandarin)...

Andre, what do you think?

Flags: needinfo?(anatal)

This is a question better suited for Eitan.

Flags: needinfo?(anatal) → needinfo?(eitan)

This a Linux platform limitation, not related directly to Firefox. This is why it is reproducible in chrome as well.

Flags: needinfo?(eitan)
Webcompat Priority: ? → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.