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][0]. 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][1]. `cmn` should be a vlid [BCP 47 language tag][2]. [0]: https://searchfox.org/mozilla-central/rev/a887c90ea9c19a0b5529a1f5fa351929944887ba/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp#578 [1]: https://w3c.github.io/speech-api/speechapi.html#utterance-attributes [2]: https://www.ietf.org/rfc/bcp/bcp47.txt
Bug 1541330 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
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][0]. 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][1]. `cmn` should be a valid [BCP 47 language tag][2]. [0]: https://searchfox.org/mozilla-central/rev/a887c90ea9c19a0b5529a1f5fa351929944887ba/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp#578 [1]: https://w3c.github.io/speech-api/speechapi.html#utterance-attributes [2]: https://www.ietf.org/rfc/bcp/bcp47.txt